|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.jcetaglib.lib.CertTools
Tools to handle common certificate operations.
Constructor Summary | |
CertTools()
Creates new CertTools |
Method Summary | |
static org.bouncycastle.asn1.x509.AuthorityKeyIdentifier |
createAuthorityKeyId(java.security.PublicKey pubKey)
|
static org.bouncycastle.asn1.x509.SubjectKeyIdentifier |
createSubjectKeyId(java.security.PublicKey pubKey)
|
static byte[] |
generateSHA1Fingerprint(byte[] ba)
Generate a SHA1 fingerprint from a byte array containing a X.509 certificate |
static java.security.cert.X509Certificate |
getCertfromPEM(java.io.InputStream certstream)
Reads a certificate in PEM-format from an InputStream. |
static java.security.cert.X509Certificate |
getCertfromPEM(java.lang.String certFile)
Reads a certificate in PEM-format from a file. |
static java.security.cert.X509CRL |
getCRLfromByteArray(byte[] crl)
Creates X509CRL from byte[]. |
static java.lang.String |
getFingerprintAsString(java.security.cert.X509Certificate cert)
Generate SHA1 fingerprint of certificate in string representation. |
static java.lang.String |
getPartFromDN(java.lang.String dn,
java.lang.String dnpart)
Gets a specified part of a DN. |
static java.security.PrivateKey |
getPrivatefromPEM(java.io.InputStream keystream,
java.lang.String keypwd)
|
static java.security.PrivateKey |
getPrivatefromPEM(java.lang.String keyFile,
java.lang.String keypwd)
|
static boolean |
isSelfSigned(java.security.cert.X509Certificate cert)
Checks if a certificate is self signed by verifying if subject and issuer are the same. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CertTools()
Method Detail |
public static java.lang.String getPartFromDN(java.lang.String dn, java.lang.String dnpart)
dn
- String containing DN, The DN string has the format "C=SE, O=xx, OU=yy, CN=zz".dnpart
- String specifying which part of the DN to get, should be "CN" or "OU" etc.
public static java.security.PrivateKey getPrivatefromPEM(java.lang.String keyFile, java.lang.String keypwd) throws java.io.IOException, java.security.NoSuchAlgorithmException, java.security.spec.InvalidKeySpecException, java.lang.Exception
java.io.IOException
java.security.NoSuchAlgorithmException
java.security.spec.InvalidKeySpecException
java.lang.Exception
public static java.security.PrivateKey getPrivatefromPEM(java.io.InputStream keystream, java.lang.String keypwd) throws java.io.IOException, java.security.NoSuchAlgorithmException, java.security.spec.InvalidKeySpecException, java.lang.Exception
java.io.IOException
java.security.NoSuchAlgorithmException
java.security.spec.InvalidKeySpecException
java.lang.Exception
public static java.security.cert.X509Certificate getCertfromPEM(java.lang.String certFile) throws java.io.IOException, java.security.cert.CertificateException
certFile
- the file containing the certificate in PEM-format
java.io.IOException
- if the filen cannot be read.
java.security.cert.CertificateException
- if the filen does not contain a correct certificate.public static java.security.cert.X509Certificate getCertfromPEM(java.io.InputStream certstream) throws java.io.IOException, java.security.cert.CertificateException
certstream
- the input stream containing the certificate in PEM-format
java.io.IOException
- if the stream cannot be read.
java.security.cert.CertificateException
- if the stream does not contain a correct certificate.public static java.security.cert.X509CRL getCRLfromByteArray(byte[] crl) throws java.security.cert.CertificateException, java.security.cert.CRLException
crl
- byte array containing CRL in DER-format
java.security.cert.CertificateException
- if the byte arrayen does not contani a correct CRL.
java.security.cert.CRLException
- if the byte arrayen does not contani a correct CRL.public static boolean isSelfSigned(java.security.cert.X509Certificate cert)
cert
- the certificate that skall be checked.
public static org.bouncycastle.asn1.x509.SubjectKeyIdentifier createSubjectKeyId(java.security.PublicKey pubKey)
public static org.bouncycastle.asn1.x509.AuthorityKeyIdentifier createAuthorityKeyId(java.security.PublicKey pubKey)
public static java.lang.String getFingerprintAsString(java.security.cert.X509Certificate cert)
cert
- X509Certificate.
public static byte[] generateSHA1Fingerprint(byte[] ba)
ba
- Byte array containing DER encoded X509Certificate.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |