|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xwiki.crypto.x509.internal.DefaultX509CryptoService
@Component @InstantiationStrategy(value=SINGLETON) public class DefaultX509CryptoService
Service allowing a user to sign text, determine the validity and signer of already signed text, and create keys.
| Constructor Summary | |
|---|---|
DefaultX509CryptoService()
|
|
| Method Summary | |
|---|---|
XWikiX509Certificate |
certFromPEM(java.lang.String pemFormatCert)
Deserialize an X509 certificate from a PEM formatted string. |
XWikiX509Certificate[] |
certsFromSpkac(java.lang.String spkacSerialization,
int daysOfValidity)
Creates an array of Base64 encoded DER formatted X509Certificates containing: 1. |
XWikiX509KeyPair |
keyPairFromBase64(java.lang.String keyPairAsBase64)
Deserialize an XWikiX509KeyPair from a base64 encoded String. |
XWikiX509KeyPair |
newCertAndPrivateKey(int daysOfValidity,
java.lang.String password)
Creates an XWikiX509Certificate and matching private key. |
java.lang.String |
signText(java.lang.String textToSign,
XWikiX509KeyPair toSignWith,
java.lang.String password)
Produce a pkcs#7 signature for the given text. |
XWikiX509Certificate |
verifyText(java.lang.String signedText,
java.lang.String base64Signature)
Verify a pkcs#7 signature and return the certificate of the user who signed it. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultX509CryptoService()
| Method Detail |
|---|
public XWikiX509Certificate[] certsFromSpkac(java.lang.String spkacSerialization,
int daysOfValidity)
throws java.security.GeneralSecurityException
certsFromSpkac in interface X509CryptoServicespkacSerialization - a SPKAC Certificate Signing RequestdaysOfValidity - number of days before the certificate should become invalid.
java.security.GeneralSecurityException - if something goes wrong while creating the certificate.X509CryptoService.certsFromSpkac(java.lang.String, int)
public XWikiX509KeyPair newCertAndPrivateKey(int daysOfValidity,
java.lang.String password)
throws java.security.GeneralSecurityException
newCertAndPrivateKey in interface X509CryptoServicedaysOfValidity - number of days before the certificate should become invalid.password - the password to set on the resulting XWikiX509KeyPair.
java.security.GeneralSecurityException - if something goes wrong while creating the certificate.org.xwiki.crypto.x509.X509CryptoService#newCertAndPrivateKey(int)
public java.lang.String signText(java.lang.String textToSign,
XWikiX509KeyPair toSignWith,
java.lang.String password)
throws java.security.GeneralSecurityException
signText in interface X509CryptoServicetextToSign - the text which the user wishes to sign.toSignWith - the certificate and matching private key to sign the text with.password - to access the private key in the key pair.
java.security.GeneralSecurityException - if anything goes wrong during signing.org.xwiki.crypto.x509.X509CryptoService#signText(java.lang.String, org.xwiki.crypto.data.XWikiX509KeyPair)
public XWikiX509Certificate verifyText(java.lang.String signedText,
java.lang.String base64Signature)
throws java.security.GeneralSecurityException
verifyText in interface X509CryptoServicesignedText - the text which has been signed.base64Signature - the signature on the text in Base64 encoded DER format.
java.security.GeneralSecurityException - if anything goes wrong.X509CryptoService.verifyText(java.lang.String, java.lang.String)
public XWikiX509Certificate certFromPEM(java.lang.String pemFormatCert)
throws java.security.GeneralSecurityException
certFromPEM in interface X509CryptoServicepemFormatCert - a String created by XWikiX509Certificate.toPEMString()
or from OpenSSL or any other standards compliant X509 certificate generator in PEM format.
XWikiX509Certificate which extends
X509Certificate and can be used by methods in this class as well as with
third party encryption tools.
java.security.GeneralSecurityException - If there isn't a valid XWikiX509Certificate.CERT_BEGIN or
XWikiX509Certificate.CERT_END tag, or if there is an exception parsing
the content inbetween.X509CryptoService.certFromPEM(java.lang.String)
public XWikiX509KeyPair keyPairFromBase64(java.lang.String keyPairAsBase64)
throws java.security.GeneralSecurityException
XWikiX509KeyPair from a base64 encoded String.
keyPairFromBase64 in interface X509CryptoServicekeyPairAsBase64 - a String created by calling
XWikiX509KeyPair.serializeAsBase64()
XWikiX509KeyPair
java.security.GeneralSecurityException - if the data has become corrupted or
if something fails during the deserialization process.X509CryptoService.keyPairFromBase64(java.lang.String)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||