本文整理汇总了Java中com.sun.squawk.security.ECPublicKey.setW方法的典型用法代码示例。如果您正苦于以下问题:Java ECPublicKey.setW方法的具体用法?Java ECPublicKey.setW怎么用?Java ECPublicKey.setW使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.squawk.security.ECPublicKey
的用法示例。
在下文中一共展示了ECPublicKey.setW方法的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;
}