|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.security.cert.Certificate
java.security.cert.X509Certificate
org.xwiki.crypto.x509.internal.AbstractX509CertificateWrapper
org.xwiki.crypto.x509.XWikiX509Certificate
public class XWikiX509Certificate
X509 certificate wrapper with several additional helper methods, aimed to be more scripting-friendly. This class cannot be an interface because it extends AbstractX509CertificateWrapper which extends X509Certificate which is not an interface. Most bouncycastle code requires an X509Certificate so if we used an interface then it would just have to be casted every time somebody wanted to use it with non xwiki-crypto cryptographic apis.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.security.cert.Certificate |
|---|
Certificate.CertificateRep |
| Field Summary |
|---|
| Fields inherited from class org.xwiki.crypto.x509.internal.AbstractX509CertificateWrapper |
|---|
certificate |
| Constructor Summary | |
|---|---|
XWikiX509Certificate(X509Certificate certificate)
Create new XWikiX509Certificate. |
|
XWikiX509Certificate(X509Certificate certificate,
String issuerFp)
Create new XWikiX509Certificate. |
|
| Method Summary | |
|---|---|
static String |
calculateFingerprint(Certificate certificate)
Calculate the fingerprint of the given certificate. |
boolean |
equals(Object obj)
|
static XWikiX509Certificate[] |
fromCertificateChain(Certificate[] x509Chain)
Convert a chain of Certificates into a chain of XWikiX509Certificates, correctly setting the
issuer fingerprint. |
static XWikiX509Certificate |
fromPEMString(String pemEncoded)
Constructor from a PEM formatted string. |
String |
getAuthorName()
Get name of the author (subject name) of this certificate. |
String |
getAuthorUID()
Get user name (stored as UID in the distinguished subject name) of this certificate's author, or empty string if UID is not present. |
String |
getFingerprint()
|
String |
getIssuerFingerprint()
Get the fingerprint of the issuer certificate. |
String |
getIssuerName()
Get issuer name of this certificate. |
int |
hashCode()
|
String |
toPEMString()
Get the internal X509 certificate in a standard PEM format. |
String |
toString()
|
| Methods inherited from class org.xwiki.crypto.x509.internal.AbstractX509CertificateWrapper |
|---|
checkValidity, checkValidity, getBasicConstraints, getCriticalExtensionOIDs, getEncoded, getExtendedKeyUsage, getExtensionValue, getIssuerAlternativeNames, getIssuerDN, getIssuerUniqueID, getIssuerX500Principal, getKeyUsage, getNonCriticalExtensionOIDs, getNotAfter, getNotBefore, getPublicKey, getSerialNumber, getSigAlgName, getSigAlgOID, getSigAlgParams, getSignature, getSubjectAlternativeNames, getSubjectDN, getSubjectUniqueID, getSubjectX500Principal, getTBSCertificate, getVersion, hasUnsupportedCriticalExtension, verify, verify |
| Methods inherited from class java.security.cert.Certificate |
|---|
getType, writeReplace |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public XWikiX509Certificate(X509Certificate certificate)
XWikiX509Certificate. Assume that the certificate is self-signed.
certificate - the actual certificate to use
public XWikiX509Certificate(X509Certificate certificate,
String issuerFp)
XWikiX509Certificate.
certificate - the actual certificate to useissuerFp - fingerprint of the issuer certificate, null if self-signed| Method Detail |
|---|
public static String calculateFingerprint(Certificate certificate)
RuntimeException on errors.
certificate - the certificate to use
public int hashCode()
hashCode in class org.xwiki.crypto.x509.internal.AbstractX509CertificateWrapperpublic boolean equals(Object obj)
equals in class org.xwiki.crypto.x509.internal.AbstractX509CertificateWrapperpublic String toString()
toString in class Certificatepublic String getFingerprint()
public String toPEMString()
throws CertificateEncodingException
CertificateEncodingException - on errorsXWikiX509Certificate#fromPEMString()
public static XWikiX509Certificate fromPEMString(String pemEncoded)
throws GeneralSecurityException
CERT_BEGIN and assume
everything until the next CERT_END is a valid PEM formatted certificate. If there
are multiple certificates in the passed string the first will be parsed, its issuer fingerprint will be set to
the fingerprint of the second certificate and all subsequent certificates will be ignored.
pemEncoded - a String containing an X509 certificate in PEM format
GeneralSecurityException - If there isn't a valid CERT_BEGIN or
CERT_END tag, or if there is an exception parsing
the content inbetween.toPEMString()public static XWikiX509Certificate[] fromCertificateChain(Certificate[] x509Chain)
Certificates into a chain of XWikiX509Certificates, correctly setting the
issuer fingerprint. The last certificate in the chain is assumed to be self-signed.
Each certificate in the input chain must be a subclass of X509Certificate, otherwise a runtime exception
is thrown (the type is Certificate[] and not X509Certificate[] just for convenience, since certificate factories
create certificate chains of this type).
x509Chain - a chain if X509 certificates
XWikiX509Certificates wrapping the certificates from the input chainpublic String getIssuerName()
getAuthorName() of the certificate
obtained via getIssuerFingerprint().
public String getIssuerFingerprint()
public String getAuthorName()
public String getAuthorUID()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||