本文整理汇总了Java中sun.security.x509.AlgorithmId.EC_oid方法的典型用法代码示例。如果您正苦于以下问题:Java AlgorithmId.EC_oid方法的具体用法?Java AlgorithmId.EC_oid怎么用?Java AlgorithmId.EC_oid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.security.x509.AlgorithmId
的用法示例。
在下文中一共展示了AlgorithmId.EC_oid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ECPrivateKeyImpl
import sun.security.x509.AlgorithmId; //导入方法依赖的package包/类
/**
* Construct a key from its components. Used by the
* KeyFactory.
*/
ECPrivateKeyImpl(BigInteger s, ECParameterSpec params)
throws InvalidKeyException {
this.s = s;
this.params = params;
// generate the encoding
algid = new AlgorithmId
(AlgorithmId.EC_oid, ECParameters.getAlgorithmParameters(params));
try {
DerOutputStream out = new DerOutputStream();
out.putInteger(1); // version 1
byte[] privBytes = ECUtil.trimZeroes(s.toByteArray());
out.putOctetString(privBytes);
DerValue val =
new DerValue(DerValue.tag_Sequence, out.toByteArray());
key = val.toByteArray();
} catch (IOException exc) {
// should never occur
throw new InvalidKeyException(exc);
}
}
示例2: ECPrivateKeyImpl
import sun.security.x509.AlgorithmId; //导入方法依赖的package包/类
/**
* Construct a key from its components. Used by the
* KeyFactory.
*/
public ECPrivateKeyImpl(BigInteger s, ECParameterSpec params)
throws InvalidKeyException {
this.s = s;
this.params = params;
// generate the encoding
algid = new AlgorithmId
(AlgorithmId.EC_oid, ECParameters.getAlgorithmParameters(params));
try {
DerOutputStream out = new DerOutputStream();
out.putInteger(1); // version 1
byte[] privBytes = ECUtil.trimZeroes(s.toByteArray());
out.putOctetString(privBytes);
DerValue val =
new DerValue(DerValue.tag_Sequence, out.toByteArray());
key = val.toByteArray();
} catch (IOException exc) {
// should never occur
throw new InvalidKeyException(exc);
}
}