Search in sources :

Example 1 with CryptographyException

use of com.intel.mtwilson.util.crypto.CryptographyException in project OpenAttestation by OpenAttestation.

the class X509Util method decodeDerPublicKey.

/**
     * @deprecated use decodeDerPublicKey in RsaUtil instead
     * @param publicKeyBytes
     * @return
     * @throws CryptographyException 
     */
public static PublicKey decodeDerPublicKey(byte[] publicKeyBytes) throws CryptographyException {
    try {
        // throws NoSuchAlgorithmException
        KeyFactory factory = KeyFactory.getInstance("RSA");
        // throws InvalidKeySpecException
        PublicKey publicKey = factory.generatePublic(new X509EncodedKeySpec(publicKeyBytes));
        return publicKey;
    } catch (Exception e) {
        throw new CryptographyException(e);
    }
}
Also used : CryptographyException(com.intel.mtwilson.util.crypto.CryptographyException) PublicKey(java.security.PublicKey) X509EncodedKeySpec(java.security.spec.X509EncodedKeySpec) KeyFactory(java.security.KeyFactory) CertificateParsingException(java.security.cert.CertificateParsingException) KeyStoreException(java.security.KeyStoreException) UnrecoverableEntryException(java.security.UnrecoverableEntryException) IOException(java.io.IOException) KeyManagementException(java.security.KeyManagementException) CertificateException(java.security.cert.CertificateException) CryptographyException(com.intel.mtwilson.util.crypto.CryptographyException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) CertificateEncodingException(java.security.cert.CertificateEncodingException)

Aggregations

CryptographyException (com.intel.mtwilson.util.crypto.CryptographyException)1 IOException (java.io.IOException)1 KeyFactory (java.security.KeyFactory)1 KeyManagementException (java.security.KeyManagementException)1 KeyStoreException (java.security.KeyStoreException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 PublicKey (java.security.PublicKey)1 UnrecoverableEntryException (java.security.UnrecoverableEntryException)1 CertificateEncodingException (java.security.cert.CertificateEncodingException)1 CertificateException (java.security.cert.CertificateException)1 CertificateParsingException (java.security.cert.CertificateParsingException)1 X509EncodedKeySpec (java.security.spec.X509EncodedKeySpec)1