List of usage examples for org.bouncycastle.pkcs.jcajce JcaPKCS8EncryptedPrivateKeyInfoBuilder JcaPKCS8EncryptedPrivateKeyInfoBuilder
public JcaPKCS8EncryptedPrivateKeyInfoBuilder(PrivateKey privateKey)
From source file:org.soulwing.credo.service.crypto.bc.BcPKCS8EncryptionService.java
License:Apache License
/** * {@inheritDoc}/*w w w . ja va2 s . c om*/ */ @Override public PrivateKeyWrapper encrypt(PrivateKeyWrapper privateKey, char[] passphrase) { Validate.notNull(passphrase, "passphrase is required"); PKCS8EncryptedPrivateKeyInfo encryptedKeyInfo = new JcaPKCS8EncryptedPrivateKeyInfoBuilder( privateKey.derive()).build(createPrivateKeyEncryptor(passphrase)); return new BcPKCS8PrivateKeyWrapper(encryptedKeyInfo, keyFactory, objectBuilderFactory); }