public class PKCS8Generator extends Object implements PemObjectGenerator
Modifier and Type | Field and Description |
---|---|
static String |
AES_128_CBC |
static String |
AES_192_CBC |
static String |
AES_256_CBC |
static String |
DES3_CBC |
static String |
PBE_SHA1_2DES |
static String |
PBE_SHA1_3DES |
static String |
PBE_SHA1_RC2_128 |
static String |
PBE_SHA1_RC2_40 |
static String |
PBE_SHA1_RC4_128 |
static String |
PBE_SHA1_RC4_40 |
Constructor and Description |
---|
PKCS8Generator(PrivateKey key)
Constructor for an unencrypted private key PEM object.
|
PKCS8Generator(PrivateKey key,
String algorithm,
Provider provider)
Constructor for an encrypted private key PEM object.
|
PKCS8Generator(PrivateKey key,
String algorithm,
String provider)
Constructor for an encrypted private key PEM object.
|
Modifier and Type | Method and Description |
---|---|
PemObject |
generate() |
PKCS8Generator |
setIterationCount(int iterationCount) |
PKCS8Generator |
setPassword(char[] password) |
PKCS8Generator |
setSecureRandom(SecureRandom random) |
public static final String AES_128_CBC
public static final String AES_192_CBC
public static final String AES_256_CBC
public static final String DES3_CBC
public static final String PBE_SHA1_RC4_128
public static final String PBE_SHA1_RC4_40
public static final String PBE_SHA1_3DES
public static final String PBE_SHA1_2DES
public static final String PBE_SHA1_RC2_128
public static final String PBE_SHA1_RC2_40
public PKCS8Generator(PrivateKey key)
key
- private key to be encoded.public PKCS8Generator(PrivateKey key, String algorithm, String provider) throws NoSuchProviderException, NoSuchAlgorithmException
key
- private key to be encodedalgorithm
- encryption algorithm to useprovider
- name of provider to useNoSuchProviderException
- if provider cannot be foundNoSuchAlgorithmException
- if algorithm/mode cannot be foundpublic PKCS8Generator(PrivateKey key, String algorithm, Provider provider) throws NoSuchAlgorithmException
key
- private key to be encodedalgorithm
- encryption algorithm to useprovider
- provider to useNoSuchAlgorithmException
- if algorithm/mode cannot be foundpublic PKCS8Generator setSecureRandom(SecureRandom random)
public PKCS8Generator setPassword(char[] password)
public PKCS8Generator setIterationCount(int iterationCount)
public PemObject generate() throws PemGenerationException
generate
in interface PemObjectGenerator
PemGenerationException
Copyright © 2015. All rights reserved.