Java Code Examples for org.apache.cxf.rt.security.crypto.CryptoUtils#loadCertificate()

The following examples show how to use org.apache.cxf.rt.security.crypto.CryptoUtils#loadCertificate() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KeyManagementUtils.java    From cxf with Apache License 2.0 5 votes vote down vote up
private static X509Certificate[] loadX509CertificateOrChain(KeyStore keyStore, String alias) {
    if (alias == null) {
        throw new JoseException("No alias supplied");
    }
    try {
        Certificate[] certs = keyStore.getCertificateChain(alias);
        if (certs != null) {
            return Arrays.copyOf(certs, certs.length, X509Certificate[].class);
        }
        return new X509Certificate[]{(X509Certificate)CryptoUtils.loadCertificate(keyStore, alias)};
    } catch (Exception ex) {
        LOG.warning("X509 Certificates can not be created");
        throw new JoseException(ex);
    }
}
 
Example 2
Source File: OAuthDataProviderImpl.java    From cxf with Apache License 2.0 4 votes vote down vote up
private Certificate loadCert() throws Exception {
    try (InputStream is = ClassLoaderUtils.getResourceAsStream("keys/Truststore.jks", this.getClass())) {
        return CryptoUtils.loadCertificate(is, "password".toCharArray(), "morpit", null);
    }
}
 
Example 3
Source File: JCacheOAuthDataProviderImpl.java    From cxf with Apache License 2.0 4 votes vote down vote up
private Certificate loadCert() throws Exception {
    try (InputStream is = ClassLoaderUtils.getResourceAsStream("keys/Truststore.jks", this.getClass())) {
        return CryptoUtils.loadCertificate(is, "password".toCharArray(), "morpit", null);
    }
}