|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.ws.security.components.crypto.CryptoBase
public abstract class CryptoBase
Created by IntelliJ IDEA. User: dims Date: Sep 15, 2005 Time: 9:50:40 AM To change this template use File | Settings | File Templates.
| Field Summary | |
|---|---|
protected KeyStore |
cacerts
|
protected static Map |
certFactMap
|
protected KeyStore |
keystore
|
| Constructor Summary | |
|---|---|
protected |
CryptoBase()
Constructor |
| Method Summary | |
|---|---|
protected static String |
createKeyStoreErrorMessage(KeyStore keystore)
|
String[] |
getAliasesForDN(String subjectDN)
Lookup X509 Certificates in the keystore according to a given DN of the subject of the certificate The search gets all alias names of the keystore and gets the certificate (chain) for each alias. |
String |
getAliasForX509Cert(byte[] skiBytes)
Lookup a X509 Certificate in the keystore according to a given SubjectKeyIdentifier. |
String |
getAliasForX509Cert(Certificate cert)
Return a X509 Certificate alias in the keystore according to a given Certificate |
String |
getAliasForX509Cert(String issuer)
Lookup a X509 Certificate in the keystore according to a given the issuer of a Certificate. |
String |
getAliasForX509Cert(String issuer,
BigInteger serialNumber)
Lookup a X509 Certificate in the keystore according to a given serial number and the issuer of a Certificate. |
String |
getAliasForX509CertThumb(byte[] thumb)
Lookup a X509 Certificate in the keystore according to a given Thumbprint. |
byte[] |
getCertificateData(boolean reverse,
X509Certificate[] certs)
get a byte array given an array of X509 certificates. |
CertificateFactory |
getCertificateFactory()
Singleton certificate factory for this Crypto instance. |
X509Certificate[] |
getCertificates(String alias)
Gets the list of certificates for a given alias. |
protected abstract String |
getCryptoProvider()
|
KeyStore |
getKeyStore()
Gets the Keystore that was loaded by the underlying implementation |
PrivateKey |
getPrivateKey(String alias,
String password)
Gets the private key identified by alias> and |
byte[] |
getSKIBytesFromCert(X509Certificate cert)
Reads the SubjectKeyIdentifier information from the certificate. |
X509Certificate[] |
getX509Certificates(byte[] data,
boolean reverse)
Construct an array of X509Certificate's from the byte array. |
X509Certificate |
loadCertificate(InputStream in)
load a X509Certificate from the input stream. |
void |
setKeyStore(KeyStore ks)
A Hook for subclasses to set the keystore without having to load it from an InputStream. |
protected Vector |
splitAndTrim(String inString)
|
boolean |
validateCertPath(X509Certificate[] certs)
Overridden because there's a bug in the base class where they don't use the provider variant for the certificate validator. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.apache.ws.security.components.crypto.Crypto |
|---|
getDefaultX509Alias |
| Field Detail |
|---|
protected static Map certFactMap
protected KeyStore keystore
protected KeyStore cacerts
| Constructor Detail |
|---|
protected CryptoBase()
| Method Detail |
|---|
protected abstract String getCryptoProvider()
public CertificateFactory getCertificateFactory()
throws WSSecurityException
getCertificateFactory in interface CryptoCertificateFactory to construct
X509 certificates
WSSecurityException
public X509Certificate loadCertificate(InputStream in)
throws WSSecurityException
loadCertificate in interface Cryptoin - The InputStream array containing the X509 data
WSSecurityException
public PrivateKey getPrivateKey(String alias,
String password)
throws Exception
alias> and password.
- Specified by:
getPrivateKey in interface Crypto
- Parameters:
alias - The alias (KeyStore) of the key ownerpassword - The password needed to access the private key
- Returns:
- The private key
- Throws:
Exception
protected static String createKeyStoreErrorMessage(KeyStore keystore)
throws KeyStoreException
KeyStoreExceptionprotected Vector splitAndTrim(String inString)
public String getAliasForX509Cert(String issuer)
throws WSSecurityException
getAliasForX509Cert in interface Cryptoissuer - The issuer's name for the certificate
WSSecurityException
public String getAliasForX509Cert(String issuer,
BigInteger serialNumber)
throws WSSecurityException
getAliasForX509Cert in interface Cryptoissuer - The issuer's name for the certificateserialNumber - The serial number of the certificate from the named issuer
WSSecurityException
public String getAliasForX509Cert(byte[] skiBytes)
throws WSSecurityException
getAliasForX509Cert in interface CryptoskiBytes - The SKI info bytes
WSSecurityException - if problems during keystore handling or wrong certificate (no SKI data)
public String getAliasForX509Cert(Certificate cert)
throws WSSecurityException
getAliasForX509Cert in interface Cryptocert - The certificate to lookup
WSSecurityException
public X509Certificate[] getCertificates(String alias)
throws WSSecurityException
getCertificates in interface Cryptoalias - Lookup certificate chain for this alias
WSSecurityException
public String getAliasForX509CertThumb(byte[] thumb)
throws WSSecurityException
getAliasForX509CertThumb in interface Cryptothumb - The SHA1 thumbprint info bytes
WSSecurityException - if problems during keystore handling or wrong certificatepublic void setKeyStore(KeyStore ks)
InputStream.
ks - existing keystore
public byte[] getSKIBytesFromCert(X509Certificate cert)
throws WSSecurityException
getSKIBytesFromCert in interface Cryptocert - The certificate to read SKI
WSSecurityExceptionpublic KeyStore getKeyStore()
Crypto
getKeyStore in interface Crypto
public String[] getAliasesForDN(String subjectDN)
throws WSSecurityException
getAliasesForDN in interface CryptosubjectDN - The DN of subject to look for in the keystore
WSSecurityException
public byte[] getCertificateData(boolean reverse,
X509Certificate[] certs)
throws WSSecurityException
getCertificateData in interface Cryptoreverse - If set the first certificate in the array data will
the last in the byte arraycerts - The certificates to convert
WSSecurityException
public X509Certificate[] getX509Certificates(byte[] data,
boolean reverse)
throws WSSecurityException
getX509Certificates in interface Cryptodata - The byte array containing the X509 datareverse - If set the first certificate in input data will
the last in the array
WSSecurityException
public boolean validateCertPath(X509Certificate[] certs)
throws WSSecurityException
validateCertPath in interface Cryptocerts - Certificate chain to validate
WSSecurityException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||