public class PKCS12Util
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static PBEAlgorithm |
DEFAULT_CERT_ENCRYPTION |
static java.lang.String |
DEFAULT_CERT_ENCRYPTION_NAME |
static PBEAlgorithm |
DEFAULT_KEY_ENCRYPTION |
static java.lang.String |
DEFAULT_KEY_ENCRYPTION_NAME |
static java.lang.String |
NO_ENCRYPTION |
static java.util.List<PBEAlgorithm> |
SUPPORTED_CERT_ENCRYPTIONS |
static java.util.List<PBEAlgorithm> |
SUPPORTED_KEY_ENCRYPTIONS |
Constructor and Description |
---|
PKCS12Util() |
Modifier and Type | Method and Description |
---|---|
void |
addCertBag(PKCS12CertInfo certInfo,
SEQUENCE safeContents) |
void |
addKeyBag(PKCS12KeyInfo keyInfo,
Password password,
SEQUENCE encSafeContents)
Add a private key to the PKCS #12 object.
|
ASN1Value |
create_EPKI_with_PBE_PKCS5_PBES2(CryptoToken token,
PrivateKey privateKey,
Password password) |
ASN1Value |
create_EPKI_with_PBE_SHA1_DES3_CBC(CryptoToken token,
PrivateKey privateKey,
Password password) |
PKCS12CertInfo |
createCertInfoFromNSS(X509Certificate cert) |
PKCS12CertInfo |
createCertInfoFromNSS(X509Certificate cert,
java.lang.String friendlyName) |
PKCS12KeyInfo |
createKeyInfoFromNSS(X509Certificate cert,
PrivateKey privateKey) |
PKCS12KeyInfo |
createKeyInfoFromNSS(X509Certificate cert,
PrivateKey privateKey,
java.lang.String friendlyName) |
PFX |
generatePFX(PKCS12 pkcs12,
Password password) |
PKCS12CertInfo |
getCertBySubjectDN(PKCS12 pkcs12,
java.lang.String subjectDN) |
PBEAlgorithm |
getCertEncryption() |
PKCS12CertInfo |
getCertInfo(SafeBag bag) |
void |
getCertInfos(PKCS12 pkcs12,
PFX pfx,
Password password) |
PBEAlgorithm |
getKeyEncryption() |
PKCS12KeyInfo |
getKeyInfo(SafeBag bag,
Password password)
Loads key bags (for IMPORT and other operations on existing
PKCS #12 files).
|
void |
getKeyInfos(PKCS12 pkcs12,
PFX pfx,
Password password) |
PrivateKey.Type |
getPrivateKeyType(java.security.PublicKey publicKey) |
java.lang.String |
getTrustFlags(X509Certificate cert) |
void |
importKey(PKCS12 pkcs12,
Password password,
java.lang.String nickname,
PKCS12KeyInfo keyInfo) |
boolean |
isTrustFlagsEnabled() |
void |
loadCertFromNSS(PKCS12 pkcs12,
java.lang.String nickname,
boolean includeKey,
boolean includeChain) |
void |
loadCertFromNSS(PKCS12 pkcs12,
java.lang.String nickname,
boolean includeKey,
boolean includeChain,
java.lang.String friendlyName) |
void |
loadCertFromNSS(PKCS12 pkcs12,
X509Certificate cert,
boolean includeKey,
boolean includeChain) |
void |
loadCertFromNSS(PKCS12 pkcs12,
X509Certificate cert,
boolean includeKey,
boolean includeChain,
java.lang.String friendlyName) |
PKCS12 |
loadFromByteArray(byte[] b,
Password password) |
PKCS12 |
loadFromFile(java.lang.String filename) |
PKCS12 |
loadFromFile(java.lang.String filename,
Password password) |
void |
loadFromNSS(PKCS12 pkcs12) |
void |
loadFromNSS(PKCS12 pkcs12,
boolean includeKey,
boolean includeChain) |
void |
setCertEncryption(PBEAlgorithm algorithm) |
void |
setCertEncryption(java.lang.String name) |
void |
setKeyEncryption(PBEAlgorithm algorithm) |
void |
setKeyEncryption(java.lang.String name) |
void |
setTrustFlags(X509Certificate cert,
java.lang.String trustFlags) |
void |
setTrustFlagsEnabled(boolean trustFlagsEnabled) |
void |
storeCertIntoNSS(PKCS12 pkcs12,
Password password,
PKCS12CertInfo certInfo,
boolean overwrite)
Store a certificate (and key, if present) in NSSDB.
|
void |
storeCertIntoNSS(PKCS12 pkcs12,
Password password,
java.lang.String nickname,
boolean overwrite) |
void |
storeIntoFile(PKCS12 pkcs12,
java.lang.String filename,
Password password) |
void |
storeIntoNSS(PKCS12 pkcs12,
Password password,
boolean overwrite) |
public static final java.lang.String NO_ENCRYPTION
public static final java.util.List<PBEAlgorithm> SUPPORTED_CERT_ENCRYPTIONS
public static final java.util.List<PBEAlgorithm> SUPPORTED_KEY_ENCRYPTIONS
public static final PBEAlgorithm DEFAULT_CERT_ENCRYPTION
public static final java.lang.String DEFAULT_CERT_ENCRYPTION_NAME
public static final PBEAlgorithm DEFAULT_KEY_ENCRYPTION
public static final java.lang.String DEFAULT_KEY_ENCRYPTION_NAME
public PKCS12Util() throws java.lang.Exception
java.lang.Exception
public void setCertEncryption(java.lang.String name) throws java.lang.Exception
java.lang.Exception
public void setCertEncryption(PBEAlgorithm algorithm) throws java.lang.Exception
java.lang.Exception
public PBEAlgorithm getCertEncryption()
public void setKeyEncryption(java.lang.String name) throws java.lang.Exception
java.lang.Exception
public void setKeyEncryption(PBEAlgorithm algorithm) throws java.lang.Exception
java.lang.Exception
public PBEAlgorithm getKeyEncryption()
public boolean isTrustFlagsEnabled()
public void setTrustFlagsEnabled(boolean trustFlagsEnabled)
public java.lang.String getTrustFlags(X509Certificate cert)
public void setTrustFlags(X509Certificate cert, java.lang.String trustFlags) throws java.lang.Exception
java.lang.Exception
public void addKeyBag(PKCS12KeyInfo keyInfo, Password password, SEQUENCE encSafeContents) throws java.lang.Exception
java.lang.Exception
public ASN1Value create_EPKI_with_PBE_SHA1_DES3_CBC(CryptoToken token, PrivateKey privateKey, Password password) throws java.lang.Exception
java.lang.Exception
public ASN1Value create_EPKI_with_PBE_PKCS5_PBES2(CryptoToken token, PrivateKey privateKey, Password password) throws java.lang.Exception
java.lang.Exception
public void addCertBag(PKCS12CertInfo certInfo, SEQUENCE safeContents) throws java.lang.Exception
java.lang.Exception
public void loadFromNSS(PKCS12 pkcs12) throws java.lang.Exception
java.lang.Exception
public void loadFromNSS(PKCS12 pkcs12, boolean includeKey, boolean includeChain) throws java.lang.Exception
java.lang.Exception
public void loadCertFromNSS(PKCS12 pkcs12, java.lang.String nickname, boolean includeKey, boolean includeChain) throws java.lang.Exception
java.lang.Exception
public void loadCertFromNSS(PKCS12 pkcs12, java.lang.String nickname, boolean includeKey, boolean includeChain, java.lang.String friendlyName) throws java.lang.Exception
java.lang.Exception
public void loadCertFromNSS(PKCS12 pkcs12, X509Certificate cert, boolean includeKey, boolean includeChain) throws java.lang.Exception
java.lang.Exception
public void loadCertFromNSS(PKCS12 pkcs12, X509Certificate cert, boolean includeKey, boolean includeChain, java.lang.String friendlyName) throws java.lang.Exception
java.lang.Exception
public PKCS12CertInfo createCertInfoFromNSS(X509Certificate cert) throws java.lang.Exception
java.lang.Exception
public PKCS12CertInfo createCertInfoFromNSS(X509Certificate cert, java.lang.String friendlyName) throws java.lang.Exception
java.lang.Exception
public PKCS12KeyInfo createKeyInfoFromNSS(X509Certificate cert, PrivateKey privateKey) throws java.lang.Exception
java.lang.Exception
public PKCS12KeyInfo createKeyInfoFromNSS(X509Certificate cert, PrivateKey privateKey, java.lang.String friendlyName) throws java.lang.Exception
java.lang.Exception
public PFX generatePFX(PKCS12 pkcs12, Password password) throws java.lang.Exception
java.lang.Exception
public void storeIntoFile(PKCS12 pkcs12, java.lang.String filename, Password password) throws java.lang.Exception
java.lang.Exception
public PKCS12KeyInfo getKeyInfo(SafeBag bag, Password password) throws java.lang.Exception
java.lang.Exception
public PKCS12CertInfo getCertInfo(SafeBag bag) throws java.lang.Exception
java.lang.Exception
public void getKeyInfos(PKCS12 pkcs12, PFX pfx, Password password) throws java.lang.Exception
java.lang.Exception
public void getCertInfos(PKCS12 pkcs12, PFX pfx, Password password) throws java.lang.Exception
java.lang.Exception
public PKCS12 loadFromFile(java.lang.String filename, Password password) throws java.lang.Exception
java.lang.Exception
public PKCS12 loadFromByteArray(byte[] b, Password password) throws java.lang.Exception
java.lang.Exception
public PKCS12 loadFromFile(java.lang.String filename) throws java.lang.Exception
java.lang.Exception
public PrivateKey.Type getPrivateKeyType(java.security.PublicKey publicKey)
public PKCS12CertInfo getCertBySubjectDN(PKCS12 pkcs12, java.lang.String subjectDN) throws java.security.cert.CertificateException
java.security.cert.CertificateException
public void importKey(PKCS12 pkcs12, Password password, java.lang.String nickname, PKCS12KeyInfo keyInfo) throws java.lang.Exception
java.lang.Exception
public void storeCertIntoNSS(PKCS12 pkcs12, Password password, PKCS12CertInfo certInfo, boolean overwrite) throws java.lang.Exception
java.lang.Exception
public void storeCertIntoNSS(PKCS12 pkcs12, Password password, java.lang.String nickname, boolean overwrite) throws java.lang.Exception
java.lang.Exception