Class CXFServerCrypto
java.lang.Object
org.apache.ws.security.components.crypto.CryptoBase
org.apache.ws.security.components.crypto.Merlin
org.wso2.carbon.webapp.ext.cxf.crypto.CXFServerCrypto
- All Implemented Interfaces:
org.apache.ws.security.components.crypto.Crypto
public class CXFServerCrypto
extends org.apache.ws.security.components.crypto.Merlin
ServerCrypto implementation to support a collection of keystores holding different trusted certs
and CA certs in CXF run time
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class org.apache.ws.security.components.crypto.Merlin
crlCertStore, CRYPTO_CERT_PROVIDER, CRYPTO_KEYSTORE_PROVIDER, keystore, KEYSTORE_ALIAS, KEYSTORE_FILE, KEYSTORE_PASSWORD, KEYSTORE_PRIVATE_PASSWORD, KEYSTORE_TYPE, LOAD_CA_CERTS, loadCACerts, OLD_KEYSTORE_FILE, privatePasswordSet, truststore, TRUSTSTORE_FILE, TRUSTSTORE_PASSWORD, TRUSTSTORE_TYPE, X509_CRL_FILEFields inherited from class org.apache.ws.security.components.crypto.CryptoBase
certFactMap, cryptoProvider, defaultAlias, NAME_CONSTRAINTS_OID -
Constructor Summary
ConstructorsConstructorDescriptionCXFServerCrypto(Properties prop) CXFServerCrypto(Properties prop, ClassLoader loader) -
Method Summary
Modifier and TypeMethodDescriptionString[]getAliasesForDN(String subjectDN) getAliasForX509Cert(byte[] skiBytes) getAliasForX509Cert(String issuer) getAliasForX509Cert(String issuer, BigInteger serialNumber) getAliasForX509CertThumb(byte[] thumb) byte[]getCertificateData(boolean reverse, X509Certificate[] certs) getCertificates(String alias) This first looks into the primary keystore and then looks at the other trust storesgetPrivateKey(String identifier, String password) Gets the private key corresponding to the identifier.getPrivateKey(X509Certificate certificate, CallbackHandler callbackHandler) Gets the private key corresponding to the certificate.byte[]getX509Certificates(byte[] data, boolean reverse) booleanvalidateCertPath(X509Certificate[] certs) Methods inherited from class org.apache.ws.security.components.crypto.Merlin
getCRLCertStore, getDefaultX509Identifier, getTrustStore, getX509Certificates, getX509Identifier, load, loadInputStream, loadProperties, loadProperties, setCRLCertStore, setKeyStore, setTrustStore, verifyTrust, verifyTrust, verifyTrustMethods inherited from class org.apache.ws.security.components.crypto.CryptoBase
createBCX509Name, getBytesFromCertificates, getCertificatesFromBytes, getCryptoProvider, setCertificateFactory, setCryptoProvider, setDefaultX509Identifier
-
Field Details
-
PROP_ID_TRUST_STORES
- See Also:
-
PROP_ID_CERT_PROVIDER
- See Also:
-
PROP_ID_DEFAULT_ALIAS
- See Also:
-
PROP_ID_CACERT_PASS
- See Also:
-
PROP_ID_XKMS_SERVICE_PASS_PHRASE
- See Also:
-
PROP_ID_TENANT_ID
- See Also:
-
PROP_ID_TENANT_DOMAIN
- See Also:
-
PROP_ID_XKMS_SERVICE_URL
- See Also:
-
-
Constructor Details
-
CXFServerCrypto
public CXFServerCrypto(Properties prop) throws org.apache.ws.security.components.crypto.CredentialException, IOException - Throws:
org.apache.ws.security.components.crypto.CredentialExceptionIOException
-
CXFServerCrypto
public CXFServerCrypto(Properties prop, ClassLoader loader) throws org.apache.ws.security.components.crypto.CredentialException, IOException - Throws:
org.apache.ws.security.components.crypto.CredentialExceptionIOException
-
-
Method Details
-
loadCertificate
public X509Certificate loadCertificate(InputStream in) throws org.apache.ws.security.WSSecurityException - Specified by:
loadCertificatein interfaceorg.apache.ws.security.components.crypto.Crypto- Overrides:
loadCertificatein classorg.apache.ws.security.components.crypto.CryptoBase- Throws:
org.apache.ws.security.WSSecurityException- See Also:
-
getX509Certificates
public X509Certificate[] getX509Certificates(byte[] data, boolean reverse) throws org.apache.ws.security.WSSecurityException - Throws:
org.apache.ws.security.WSSecurityException- See Also:
-
getCertificateData
public byte[] getCertificateData(boolean reverse, X509Certificate[] certs) throws org.apache.ws.security.WSSecurityException - Throws:
org.apache.ws.security.WSSecurityException- See Also:
-
getCertificates
public X509Certificate[] getCertificates(String alias) throws org.apache.ws.security.WSSecurityException This first looks into the primary keystore and then looks at the other trust stores- Throws:
org.apache.ws.security.WSSecurityException- See Also:
-
getAliasForX509Cert
public String getAliasForX509Cert(Certificate cert) throws org.apache.ws.security.WSSecurityException - Throws:
org.apache.ws.security.WSSecurityException- See Also:
-
getAliasForX509Cert
- Throws:
org.apache.ws.security.WSSecurityException- See Also:
-
getAliasForX509Cert
public String getAliasForX509Cert(String issuer, BigInteger serialNumber) throws org.apache.ws.security.WSSecurityException - Throws:
org.apache.ws.security.WSSecurityException- See Also:
-
getAliasForX509Cert
public String getAliasForX509Cert(byte[] skiBytes) throws org.apache.ws.security.WSSecurityException - Throws:
org.apache.ws.security.WSSecurityException- See Also:
-
getDefaultX509Alias
- See Also:
-
getSKIBytesFromCert
public byte[] getSKIBytesFromCert(X509Certificate cert) throws org.apache.ws.security.WSSecurityException - Specified by:
getSKIBytesFromCertin interfaceorg.apache.ws.security.components.crypto.Crypto- Overrides:
getSKIBytesFromCertin classorg.apache.ws.security.components.crypto.CryptoBase- Throws:
org.apache.ws.security.WSSecurityException- See Also:
-
getAliasForX509CertThumb
public String getAliasForX509CertThumb(byte[] thumb) throws org.apache.ws.security.WSSecurityException - Throws:
org.apache.ws.security.WSSecurityException- See Also:
-
getKeyStore
- Overrides:
getKeyStorein classorg.apache.ws.security.components.crypto.Merlin- See Also:
-
getCertificateFactory
- Specified by:
getCertificateFactoryin interfaceorg.apache.ws.security.components.crypto.Crypto- Overrides:
getCertificateFactoryin classorg.apache.ws.security.components.crypto.Merlin- Throws:
org.apache.ws.security.WSSecurityException- See Also:
-
validateCertPath
public boolean validateCertPath(X509Certificate[] certs) throws org.apache.ws.security.WSSecurityException - Throws:
org.apache.ws.security.WSSecurityException- See Also:
-
getAliasesForDN
- Throws:
org.apache.ws.security.WSSecurityException- See Also:
-
getPrivateKey
public PrivateKey getPrivateKey(String identifier, String password) throws org.apache.ws.security.WSSecurityException Gets the private key corresponding to the identifier. Within carbon server, we will be reading them from server configuration according to the tenant- Specified by:
getPrivateKeyin interfaceorg.apache.ws.security.components.crypto.Crypto- Overrides:
getPrivateKeyin classorg.apache.ws.security.components.crypto.Merlin- Parameters:
identifier- The implementation-specific identifier corresponding to the keypassword- The password needed to get the key- Returns:
- The private key
- Throws:
org.apache.ws.security.WSSecurityException
-
getPrivateKey
public PrivateKey getPrivateKey(X509Certificate certificate, CallbackHandler callbackHandler) throws org.apache.ws.security.WSSecurityException Gets the private key corresponding to the certificate.- Specified by:
getPrivateKeyin interfaceorg.apache.ws.security.components.crypto.Crypto- Overrides:
getPrivateKeyin classorg.apache.ws.security.components.crypto.Merlin- Parameters:
certificate- The X509Certificate corresponding to the private keycallbackHandler- The callbackHandler needed to get the password- Returns:
- The private key
- Throws:
org.apache.ws.security.WSSecurityException
-