Example usage for org.bouncycastle.pkcs.jcajce JcaPKCS8EncryptedPrivateKeyInfoBuilder JcaPKCS8EncryptedPrivateKeyInfoBuilder

List of usage examples for org.bouncycastle.pkcs.jcajce JcaPKCS8EncryptedPrivateKeyInfoBuilder JcaPKCS8EncryptedPrivateKeyInfoBuilder

Introduction

In this page you can find the example usage for org.bouncycastle.pkcs.jcajce JcaPKCS8EncryptedPrivateKeyInfoBuilder JcaPKCS8EncryptedPrivateKeyInfoBuilder.

Prototype

public JcaPKCS8EncryptedPrivateKeyInfoBuilder(PrivateKey privateKey) 

Source Link

Usage

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);
}