|
|||||||||||
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
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 java.security.KeyStore |
cacerts
|
protected static java.util.Map |
certFactMap
|
protected java.security.KeyStore |
keystore
|
Constructor Summary | |
protected |
CryptoBase()
Constructor |
Method Summary | |
protected static java.lang.String |
createKeyStoreErrorMessage(java.security.KeyStore keystore)
|
java.lang.String[] |
getAliasesForDN(java.lang.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. |
java.lang.String |
getAliasForX509Cert(byte[] skiBytes)
Lookup a X509 Certificate in the keystore according to a given SubjectKeyIdentifier. |
java.lang.String |
getAliasForX509Cert(java.security.cert.Certificate cert)
Return a X509 Certificate alias in the keystore according to a given Certificate |
java.lang.String |
getAliasForX509Cert(java.lang.String issuer)
Lookup a X509 Certificate in the keystore according to a given the issuer of a Certificate. |
java.lang.String |
getAliasForX509Cert(java.lang.String issuer,
java.math.BigInteger serialNumber)
Lookup a X509 Certificate in the keystore according to a given serial number and the issuer of a Certificate. |
java.lang.String |
getAliasForX509CertThumb(byte[] thumb)
Lookup a X509 Certificate in the keystore according to a given Thumbprint. |
byte[] |
getCertificateData(boolean reverse,
java.security.cert.X509Certificate[] certs)
get a byte array given an array of X509 certificates. |
java.security.cert.CertificateFactory |
getCertificateFactory()
Singleton certificate factory for this Crypto instance. |
java.security.cert.X509Certificate[] |
getCertificates(java.lang.String alias)
Gets the list of certificates for a given alias. |
protected abstract java.lang.String |
getCryptoProvider()
|
java.security.KeyStore |
getKeyStore()
Gets the Keystore that was loaded by the underlying implementation |
java.security.PrivateKey |
getPrivateKey(java.lang.String alias,
java.lang.String password)
Gets the private key identified by alias> and |
byte[] |
getSKIBytesFromCert(java.security.cert.X509Certificate cert)
Reads the SubjectKeyIdentifier information from the certificate. |
java.security.cert.X509Certificate[] |
getX509Certificates(byte[] data,
boolean reverse)
Construct an array of X509Certificate's from the byte array. |
java.security.cert.X509Certificate |
loadCertificate(java.io.InputStream in)
load a X509Certificate from the input stream. |
void |
setKeyStore(java.security.KeyStore ks)
A Hook for subclasses to set the keystore without having to load it from an InputStream . |
protected java.util.Vector |
splitAndTrim(java.lang.String inString)
|
boolean |
validateCertPath(java.security.cert.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 java.util.Map certFactMap
protected java.security.KeyStore keystore
protected java.security.KeyStore cacerts
Constructor Detail |
protected CryptoBase()
Method Detail |
protected abstract java.lang.String getCryptoProvider()
public java.security.cert.CertificateFactory getCertificateFactory() throws WSSecurityException
getCertificateFactory
in interface Crypto
CertificateFactory
to construct
X509 certificates
WSSecurityException
public java.security.cert.X509Certificate loadCertificate(java.io.InputStream in) throws WSSecurityException
loadCertificate
in interface Crypto
in
- The InputStream
array containing the X509 data
WSSecurityException
public java.security.PrivateKey getPrivateKey(java.lang.String alias, java.lang.String password) throws java.lang.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:
java.lang.Exception
protected static java.lang.String createKeyStoreErrorMessage(java.security.KeyStore keystore) throws java.security.KeyStoreException
java.security.KeyStoreException
protected java.util.Vector splitAndTrim(java.lang.String inString)
public java.lang.String getAliasForX509Cert(java.lang.String issuer) throws WSSecurityException
getAliasForX509Cert
in interface Crypto
issuer
- The issuer's name for the certificate
WSSecurityException
public java.lang.String getAliasForX509Cert(java.lang.String issuer, java.math.BigInteger serialNumber) throws WSSecurityException
getAliasForX509Cert
in interface Crypto
issuer
- The issuer's name for the certificateserialNumber
- The serial number of the certificate from the named issuer
WSSecurityException
public java.lang.String getAliasForX509Cert(byte[] skiBytes) throws WSSecurityException
getAliasForX509Cert
in interface Crypto
skiBytes
- The SKI info bytes
WSSecurityException
- if problems during keystore handling or wrong certificate (no SKI data)public java.lang.String getAliasForX509Cert(java.security.cert.Certificate cert) throws WSSecurityException
getAliasForX509Cert
in interface Crypto
cert
- The certificate to lookup
WSSecurityException
public java.security.cert.X509Certificate[] getCertificates(java.lang.String alias) throws WSSecurityException
getCertificates
in interface Crypto
alias
- Lookup certificate chain for this alias
WSSecurityException
public java.lang.String getAliasForX509CertThumb(byte[] thumb) throws WSSecurityException
getAliasForX509CertThumb
in interface Crypto
thumb
- The SHA1 thumbprint info bytes
WSSecurityException
- if problems during keystore handling or wrong certificatepublic void setKeyStore(java.security.KeyStore ks)
InputStream
.
ks
- existing keystorepublic byte[] getSKIBytesFromCert(java.security.cert.X509Certificate cert) throws WSSecurityException
getSKIBytesFromCert
in interface Crypto
cert
- The certificate to read SKI
WSSecurityException
public java.security.KeyStore getKeyStore()
Crypto
getKeyStore
in interface Crypto
public java.lang.String[] getAliasesForDN(java.lang.String subjectDN) throws WSSecurityException
getAliasesForDN
in interface Crypto
subjectDN
- The DN of subject to look for in the keystore
WSSecurityException
public byte[] getCertificateData(boolean reverse, java.security.cert.X509Certificate[] certs) throws WSSecurityException
getCertificateData
in interface Crypto
reverse
- If set the first certificate in the array data will
the last in the byte arraycerts
- The certificates to convert
WSSecurityException
public java.security.cert.X509Certificate[] getX509Certificates(byte[] data, boolean reverse) throws WSSecurityException
getX509Certificates
in interface Crypto
data
- 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(java.security.cert.X509Certificate[] certs) throws WSSecurityException
validateCertPath
in interface Crypto
certs
- Certificate chain to validate
WSSecurityException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |