Example usage for org.bouncycastle.pkcs PKCS8EncryptedPrivateKeyInfoBuilder build

List of usage examples for org.bouncycastle.pkcs PKCS8EncryptedPrivateKeyInfoBuilder build

Introduction

In this page you can find the example usage for org.bouncycastle.pkcs PKCS8EncryptedPrivateKeyInfoBuilder build.

Prototype

public PKCS8EncryptedPrivateKeyInfo build(OutputEncryptor encryptor) 

Source Link

Usage

From source file:org.xipki.commons.security.pkcs11.emulator.PrivateKeyCryptor.java

License:Open Source License

PKCS8EncryptedPrivateKeyInfo encrypt(final PrivateKey privateKey) {
    ParamUtil.requireNonNull("privateKey", privateKey);
    PrivateKeyInfo privateKeyInfo = PrivateKeyInfo.getInstance(privateKey.getEncoded());
    PKCS8EncryptedPrivateKeyInfoBuilder builder = new PKCS8EncryptedPrivateKeyInfoBuilder(privateKeyInfo);
    synchronized (encryptor) {
        return builder.build(encryptor);
    }//from   w  w  w .j a va2s.  co  m
}