|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.glite.voms.PKIUtils
public class PKIUtils
Constructor Summary | |
---|---|
PKIUtils()
|
Method Summary | |
---|---|
static boolean |
checkIssued(java.security.cert.X509Certificate issuer,
java.security.cert.X509Certificate issued)
Checks if a certificate issued another certificate, according to RFC 3280. |
static boolean |
DNCompare(java.lang.String dn1,
java.lang.String dn2)
|
static org.bouncycastle.asn1.x509.AuthorityKeyIdentifier |
getAKID(java.security.cert.X509Certificate cert)
Gets the AuthorityKeyIdentifier extension form the passed certificate. |
static java.lang.String |
getBaseName(java.io.File f)
Gets the basename of a file. |
static org.bouncycastle.asn1.x509.BasicConstraints |
getBasicConstraints(java.security.cert.X509Certificate cert)
Gets the BasicConstraints extension form the passed certificate. |
static java.lang.String |
getHash(byte[] name)
Gets the MD5 hash value of the given byte array. |
static java.lang.String |
getHash(javax.security.auth.x500.X500Principal principal)
Gets the MD5 hash value of the given principal. |
static java.lang.String |
getHash(java.security.cert.X509Certificate x509)
Gets the MD5 hash value of the subject of the given certificate. |
static java.lang.String |
getHash(java.security.cert.X509CRL crl)
Gets the MD5 hash value of the issuer of the given CRL. |
static java.lang.String |
getHash(org.bouncycastle.jce.X509Principal principal)
Gets the MD5 hash value of the given principal. |
static java.lang.String |
getOpenSSLFormatPrincipal(java.security.Principal principal)
|
static java.lang.String |
getOpenSSLFormatPrincipal(java.security.Principal principal,
boolean reverse)
Gets an OpenSSL-style representation of a principal. |
static org.bouncycastle.asn1.x509.SubjectKeyIdentifier |
getSKID(java.security.cert.X509Certificate cert)
Gets the SubjectKeyIdentifier extension form the passed certificate. |
static boolean |
isCA(java.security.cert.X509Certificate cert)
Checks if the passed certificate is a CA certificate. |
static boolean |
isProxy(java.security.cert.X509Certificate cert)
Checks if the passed certificate is a proxy certificate. |
static java.security.cert.X509Certificate[] |
loadCertificates(java.io.File file)
Loads a set of credentials from a file. |
static java.security.cert.X509Certificate[] |
loadCertificates(java.lang.String filename)
Loads a set of credentials from a file. |
static java.security.cert.X509CRL |
loadCRL(java.io.File file)
Loads a CRL from a file. |
static java.security.cert.X509CRL |
loadCRL(java.lang.String filename)
Loads a CRL from a file. |
static java.security.PrivateKey |
loadPrivateKey(java.io.File file,
org.bouncycastle.openssl.PasswordFinder finder)
|
static java.security.PrivateKey |
loadPrivateKey(java.lang.String filename,
org.bouncycastle.openssl.PasswordFinder finder)
|
static java.lang.String |
Normalize(java.lang.String dn)
Compares two DNs for equality, taking into account different representations for the Email and UserID tags. |
static java.lang.Object |
readObject(java.io.File f)
Reads either a certificate or a CRL from a file. |
static boolean |
selfIssued(java.security.cert.X509Certificate cert)
Checks if the give certificate is self-issued. |
static int |
skipToCertBeginning(java.io.BufferedInputStream stream)
Prepares a BufferedInputStream to read either a certificate or a CRL from it. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PKIUtils()
Method Detail |
---|
public static java.lang.String getHash(java.security.cert.X509Certificate x509)
x509
- The certificate from which to get the subject.
java.lang.IllegalArgumentException
- if x509 is null.
InvalidStateException
- if the MD5 algorithm is not supported.public static java.lang.String getHash(java.security.cert.X509CRL crl)
crl
- The CRL from which to get the issuer.
java.lang.IllegalArgumentException
- if crl is null.
InvalidStateException
- if the MD5 algorithm is not supported.public static java.lang.String getHash(org.bouncycastle.jce.X509Principal principal)
principal
- the principal.
java.lang.IllegalArgumentException
- if crl is null.
InvalidStateException
- if the MD5 algorithm is not supported.public static java.lang.String getHash(javax.security.auth.x500.X500Principal principal)
principal
- the principal.
java.lang.IllegalArgumentException
- if crl is null.
InvalidStateException
- if the MD5 algorithm is not supported.public static java.lang.String getHash(byte[] name)
name
- the data from which to compute the hash.
java.lang.IllegalArgumentException
- if crl is null.
InvalidStateException
- if the MD5 algorithm is not supported.public static java.lang.String getOpenSSLFormatPrincipal(java.security.Principal principal)
public static java.lang.String getOpenSSLFormatPrincipal(java.security.Principal principal, boolean reverse)
principal
- the principal
public static java.lang.String Normalize(java.lang.String dn)
dn1
- the first dn to compare.dn2
- the second dn to compare
public static boolean DNCompare(java.lang.String dn1, java.lang.String dn2)
public static java.lang.String getBaseName(java.io.File f)
f
- File object representing a file.
public static boolean selfIssued(java.security.cert.X509Certificate cert)
cert
- The certificate to check.
public static boolean checkIssued(java.security.cert.X509Certificate issuer, java.security.cert.X509Certificate issued)
issuer
- The candidate issuer certificate.issued
- The candidate issued certificate.
public static boolean isCA(java.security.cert.X509Certificate cert)
cert
- the candidate CA certificate.
public static boolean isProxy(java.security.cert.X509Certificate cert)
cert
- the candidate proxy certificate.
public static org.bouncycastle.asn1.x509.AuthorityKeyIdentifier getAKID(java.security.cert.X509Certificate cert)
cert
- The certificate from which to get the extension.
public static org.bouncycastle.asn1.x509.SubjectKeyIdentifier getSKID(java.security.cert.X509Certificate cert)
cert
- The certificate from which to get the extension.
public static org.bouncycastle.asn1.x509.BasicConstraints getBasicConstraints(java.security.cert.X509Certificate cert)
cert
- The certificate from which to get the extension.
public static java.security.PrivateKey loadPrivateKey(java.lang.String filename, org.bouncycastle.openssl.PasswordFinder finder)
public static java.security.PrivateKey loadPrivateKey(java.io.File file, org.bouncycastle.openssl.PasswordFinder finder)
public static java.security.cert.X509Certificate[] loadCertificates(java.lang.String filename) throws java.security.cert.CertificateException
filename
- the name of the file from which to load the certificates.
java.security.cert.CertificateException
- if there were problems parsing the certificates.
java.lang.IllegalArgumentException
- if the file cannot be found.public static java.security.cert.X509Certificate[] loadCertificates(java.io.File file) throws java.security.cert.CertificateException
file
- the File object from which to load the certificates.
java.security.cert.CertificateException
- if there were problems parsing the certificates.
java.lang.IllegalArgumentException
- if the file cannot be found.File
public static java.security.cert.X509CRL loadCRL(java.lang.String filename) throws java.security.cert.CRLException
filename
- the name of the file from which to load the CRL.
java.security.cert.CRLException
- if there were problems parsing the CRL.
java.lang.IllegalArgumentException
- if the file cannot be found.public static java.security.cert.X509CRL loadCRL(java.io.File file) throws java.security.cert.CRLException
file
- the File object from which to load the CRL.
java.security.cert.CRLException
- if there were problems parsing the CRL.
java.lang.IllegalArgumentException
- if the file cannot be found.public static java.lang.Object readObject(java.io.File f) throws java.io.IOException, java.security.cert.CertificateException, java.security.cert.CRLException
f
- the file from which to read;
java.io.IOException
- if there have been problems reading the file.
java.security.cert.CertificateException
- if there have been problems parsing the certificate.
java.security.cert.CRLException
- if there have been problems parsing the CRL.public static int skipToCertBeginning(java.io.BufferedInputStream stream) throws java.io.IOException
stream
- The stream to read and skip.
java.io.IOException
- Thrown if there is a problem skipping.
Note: this a modified version of code originally written by Joni Hakhala
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |