public class CertificateHolder
extends java.lang.Object
To learn more, visit the Work with Digital Signatures documentation article.
CertificateHolder can be created by static factory methods only. It contains an instance of X509Certificate2 which is used to introduce private, public keys and certificate chains into the system. This class is applied in DigitalSignatureUtil and PdfDigitalSignatureDetails instead of obsolete methods with X509Certificate2 as parameters.
| Modifier and Type | Method and Description |
|---|---|
static CertificateHolder |
create(byte[] certBytes,
java.lang.String password)
Creates CertificateHolder object using byte array of PKCS12 store and its password.
|
static CertificateHolder |
create(java.lang.String fileName,
java.lang.String password)
Creates CertificateHolder object using path to PKCS12 store and its password.
|
static CertificateHolder |
create(java.lang.String fileName,
java.lang.String password,
java.lang.String alias)
Creates CertificateHolder object using path to PKCS12 store, its password and the alias by using which private key and certificate will be found.
|
X509Certificate2Wrapper |
getCertificate()
Returns the instance of X509Certificate2Wrapper that holds X509Certificate2 which holds private, public keys and certificate chain.
|
public X509Certificate2Wrapper getCertificate()
public static CertificateHolder create(byte[] certBytes, java.lang.String password) throws java.lang.Exception
certBytes - A byte array that contains data from an X.509 certificate.password - The password required to access the X.509 certificate data.java.lang.SecurityException - Thrown if PKCS12 store contains no aliasesjava.io.IOException - Thrown if there is wrong password or corrupted file.java.lang.Exceptionpublic static CertificateHolder create(java.lang.String fileName, java.lang.String password) throws java.lang.Exception
fileName - The name of a certificate file.password - The password required to access the X.509 certificate data.java.lang.SecurityException - Thrown if PKCS12 store contains no aliasesjava.io.IOException - Thrown if there is wrong password or corrupted file.java.lang.Exceptionpublic static CertificateHolder create(java.lang.String fileName, java.lang.String password, java.lang.String alias) throws java.lang.Exception
fileName - The name of a certificate file.password - The password required to access the X.509 certificate data.alias - The associated alias for a certificate and its private keyjava.lang.SecurityException - Thrown if PKCS12 store contains no aliasesjava.io.IOException - Thrown if there is wrong password or corrupted file.java.lang.SecurityException - Thrown if there is no private key with the given aliasjava.lang.Exception