Class CertUtils
- java.lang.Object
-
- com.adobe.internal.pdftoolkit.core.credentials.impl.utils.CertUtils
-
public class CertUtils extends java.lang.ObjectA collection of utility methods related to cert creation and conversion
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[][]buildDERCertChain(java.security.cert.Certificate[] certChain)Converts a java Certificate Chain to a der encoded byte array.static intcomputeJavaPrivateKeySize(java.security.PrivateKey privateKey)Computes the size of a JCE PrivateKeystatic java.security.PrivateKeycreateJCEPrivateKey(byte[] encodedPriKey, java.lang.String keyWrappingFormat)Create a JCE PrivateKey given a DER encoded set of bytes representing the key.static PrivateKeyHoldercreateJCEPrivateKeyHolder(byte[] encodedPriKey, java.lang.String keyWrappingFormat)Create a JCE PrivateKey given a DER encoded set of bytes representing the key.static java.lang.StringgetCommonSubjectName(java.security.cert.X509Certificate x509Certificate)Returns value of "CN" attribute from subject name of this certificate.static java.security.cert.CertificateimportCertificate(byte[] certData)Creates a JCE X509 certificate from a DER encoded byte array representing the certificate.static java.security.cert.Certificate[]importCertificateChain(byte[][] certData)Creates a JCE X509 certificate chain from a DER encoded byte array representing the cert chain
-
-
-
Method Detail
-
importCertificate
public static java.security.cert.Certificate importCertificate(byte[] certData) throws java.security.cert.CertificateException, java.io.IOExceptionCreates a JCE X509 certificate from a DER encoded byte array representing the certificate.- Parameters:
certData-- Returns:
- java.security.cert.Certificate
- Throws:
java.security.cert.CertificateExceptionjava.io.IOException
-
importCertificateChain
public static java.security.cert.Certificate[] importCertificateChain(byte[][] certData) throws java.security.cert.CertificateException, java.io.IOExceptionCreates a JCE X509 certificate chain from a DER encoded byte array representing the cert chain- Parameters:
certData-- Returns:
- certificate chain
- Throws:
java.security.cert.CertificateExceptionjava.io.IOException
-
createJCEPrivateKey
public static java.security.PrivateKey createJCEPrivateKey(byte[] encodedPriKey, java.lang.String keyWrappingFormat) throws java.security.NoSuchAlgorithmException, java.security.spec.InvalidKeySpecExceptionCreate a JCE PrivateKey given a DER encoded set of bytes representing the key.- Parameters:
encodedPriKey-keyWrappingFormat-- Returns:
- PrivateKey
- Throws:
java.security.NoSuchAlgorithmExceptionjava.security.spec.InvalidKeySpecException
-
createJCEPrivateKeyHolder
public static PrivateKeyHolder createJCEPrivateKeyHolder(byte[] encodedPriKey, java.lang.String keyWrappingFormat) throws java.security.NoSuchAlgorithmException, java.security.spec.InvalidKeySpecException
Create a JCE PrivateKey given a DER encoded set of bytes representing the key.- Parameters:
encodedPriKey-keyWrappingFormat-- Returns:
- JCEPrivateKeyHolder
- Throws:
java.security.NoSuchAlgorithmExceptionjava.security.spec.InvalidKeySpecException
-
buildDERCertChain
public static byte[][] buildDERCertChain(java.security.cert.Certificate[] certChain) throws java.security.cert.CertificateEncodingException, java.security.cert.CertificateExceptionConverts a java Certificate Chain to a der encoded byte array.- Parameters:
certChain-- Returns:
- byte[][] representing the der cert chain
- Throws:
java.security.cert.CertificateEncodingExceptionjava.security.cert.CertificateException
-
computeJavaPrivateKeySize
public static int computeJavaPrivateKeySize(java.security.PrivateKey privateKey) throws java.security.NoSuchAlgorithmException, java.security.spec.InvalidKeySpecExceptionComputes the size of a JCE PrivateKey- Parameters:
privateKey-- Returns:
- size of the JCE PrivateKey
- Throws:
java.security.NoSuchAlgorithmExceptionjava.security.spec.InvalidKeySpecException
-
getCommonSubjectName
public static java.lang.String getCommonSubjectName(java.security.cert.X509Certificate x509Certificate)
Returns value of "CN" attribute from subject name of this certificate.- Parameters:
x509Certificate-- Returns:
- String
-
-