List of usage examples for org.bouncycastle.jcajce.provider.asymmetric.util KeyUtil getEncodedPrivateKeyInfo
public static byte[] getEncodedPrivateKeyInfo(AlgorithmIdentifier algId, ASN1Encodable privKey)
From source file:org.xipki.security.bcext.BCRSAPrivateCrtKey.java
License:Open Source License
/** * Return a PKCS8 representation of the key. The sequence returned * represents a full PrivateKeyInfo object. * * @return a PKCS8 representation of the key. *///from ww w .j av a 2 s . com public byte[] getEncoded() { AlgorithmIdentifier algId = new AlgorithmIdentifier(PKCSObjectIdentifiers.rsaEncryption, DERNull.INSTANCE); RSAPrivateKey key = new RSAPrivateKey(getModulus(), getPublicExponent(), getPrivateExponent(), getPrimeP(), getPrimeQ(), getPrimeExponentP(), getPrimeExponentQ(), getCrtCoefficient()); return KeyUtil.getEncodedPrivateKeyInfo(algId, key); }
From source file:org.xipki.security.bcext.BCRSAPrivateKey.java
License:Open Source License
public byte[] getEncoded() { return KeyUtil.getEncodedPrivateKeyInfo( new AlgorithmIdentifier(PKCSObjectIdentifiers.rsaEncryption, DERNull.INSTANCE), new org.bouncycastle.asn1.pkcs.RSAPrivateKey(getModulus(), ZERO, getPrivateExponent(), ZERO, ZERO, ZERO, ZERO, ZERO));//from ww w . j av a2s .co m }