本文整理汇总了Java中com.sun.squawk.security.ECPublicKey类的典型用法代码示例。如果您正苦于以下问题:Java ECPublicKey类的具体用法?Java ECPublicKey怎么用?Java ECPublicKey使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ECPublicKey类属于com.sun.squawk.security包,在下文中一共展示了ECPublicKey类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPublicECKeyFromX962Encoding
import com.sun.squawk.security.ECPublicKey; //导入依赖的package包/类
/** gets the ECPublicKey from the X962 encoding in a byte array
* @param publicKeyS EC public key in X962 encoding. Must be a SEC160r key.
* @return ECPublicKey the Elliptic curve public key, or null if publicKeyS
* is not a valid key
*/
private static ECPublicKey getPublicECKeyFromX962Encoding(byte[] publicKeyBA, int offset, int length) throws CryptoException {
//KeyPair keyPair = new KeyPair(KeyPair.ALG_EC_FP, ECKey.SECP160R1);
//keyPair.genKeyPair();
//ECPublicKey publicKey=new ECPublicKeyImpl();
ECPublicKey newKey=new ECPublicKey();
if (SignatureVerifier.DEBUG) {
System.out.println("getPublicECKeyFromX962Encoding:"+HexEncoding.hexEncode(publicKeyBA,publicKeyBA.length));
}
//((ECPublicKey)keyPair.getPublic()).setW(publicKeyBA,0, publicKeyBA.length);
newKey.setW(publicKeyBA,offset, length);
if (SignatureVerifier.DEBUG) {
byte [] buf= new byte[length];
newKey.getW(buf, 0);
System.out.println("getPublicECKeyFromX962Encoding from point:"+HexEncoding.hexEncode(buf,buf.length));
}
//return (ECPublicKey)keyPair.getPublic();
return newKey;
}