|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xwiki.crypto.x509.internal.DefaultXWikiX509KeyPair
public class DefaultXWikiX509KeyPair
Wrapper for storing a PrivateKey and the corresponding XWikiX509Certificate.
| Field Summary |
|---|
| Fields inherited from interface org.xwiki.crypto.x509.XWikiX509KeyPair |
|---|
BASE64_FOOTER, BASE64_HEADER |
| Constructor Summary | |
|---|---|
DefaultXWikiX509KeyPair(java.security.cert.X509Certificate certificate,
java.security.PrivateKey key,
java.lang.String password,
PasswordCryptoService passwordCryptoService)
Create new XWikiX509KeyPair. |
|
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object obj)
|
static XWikiX509KeyPair |
fromBase64String(byte[] keyPairAsBytes)
Deserialize an instance of XWikiX509KeyPair from a byte array, opposite of serialize(). |
static XWikiX509KeyPair |
fromBase64String(java.lang.String keyPairAsBase64)
Deserialize an instance of XWikiX509KeyPair from a base-64 String, opposite of serializeAsBase64(). |
XWikiX509Certificate |
getCertificate()
Get the user's certificate. |
java.lang.String |
getFingerprint()
|
java.security.PrivateKey |
getPrivateKey(java.lang.String password)
Get the private key from the key pair. |
java.security.PublicKey |
getPublicKey()
|
int |
hashCode()
|
byte[] |
serialize()
|
java.lang.String |
serializeAsBase64()
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultXWikiX509KeyPair(java.security.cert.X509Certificate certificate,
java.security.PrivateKey key,
java.lang.String password,
PasswordCryptoService passwordCryptoService)
throws java.security.GeneralSecurityException
XWikiX509KeyPair.
certificate - a certificate matching the private key, this will be stored unencrypted.key - the private key to use, this will be password encrypted.password - the password to require if a user wants to extract the private key.passwordCryptoService - the service to use for encrypting the private key so this object can safely be
serialized without allowing the private key to be read from the database.
java.security.GeneralSecurityException - if encrypting the private key fails.| Method Detail |
|---|
public static XWikiX509KeyPair fromBase64String(java.lang.String keyPairAsBase64)
throws java.io.IOException,
java.lang.ClassNotFoundException,
java.security.cert.CertificateException
serializeAsBase64().
keyPairAsBase64 - a base-64 String as produced by serializeAsBase64().
java.io.IOException - if something goes wrong within the serialization framework.
java.lang.ClassNotFoundException - if the object which was serialized is not available now.
java.security.cert.CertificateException - if deserialization of the certificate fails.
public static XWikiX509KeyPair fromBase64String(byte[] keyPairAsBytes)
throws java.io.IOException,
java.lang.ClassNotFoundException,
java.security.cert.CertificateException
serialize().
keyPairAsBytes - an array of bytes as produced by serialize().
java.io.IOException - if something goes wrong within the serialization framework.
java.lang.ClassNotFoundException - if the object which was serialized is not available now.
java.security.cert.CertificateException - if deserialization of the certificate fails.
public java.lang.String serializeAsBase64()
throws java.io.IOException
serializeAsBase64 in interface XWikiX509KeyPairXWikiX509KeyPair.serialize()d and converted to a base-64 encoded String.
java.io.IOException - if something goes wrong within the serialization framework.XWikiX509KeyPair.serializeAsBase64()
public byte[] serialize()
throws java.io.IOException
serialize in interface XWikiX509KeyPairjava.io.IOException - if something goes wrong within the serialization framework.XWikiX509KeyPair.serialize()public int hashCode()
hashCode in class java.lang.ObjectObject.hashCode()public boolean equals(java.lang.Object obj)
equals in class java.lang.ObjectObject.equals(java.lang.Object)public java.lang.String toString()
toString in class java.lang.ObjectObject.toString()public XWikiX509Certificate getCertificate()
RuntimeException if the key pair was deserialized directly using
Java deserialization methods without checking that the certificate can be deserialized.
getCertificate in interface XWikiX509KeyPairXWikiX509KeyPair.getCertificate()public java.security.PublicKey getPublicKey()
getPublicKey in interface XWikiX509KeyPairXWikiX509KeyPair.getPublicKey()
public java.security.PrivateKey getPrivateKey(java.lang.String password)
throws java.security.GeneralSecurityException
getPrivateKey in interface XWikiX509KeyPairpassword - the password needed to decrypt the private key.
java.security.GeneralSecurityException - if the private key cannot be decrypted.XWikiX509KeyPair.getPrivateKey(java.lang.String)public java.lang.String getFingerprint()
getFingerprint in interface XWikiX509KeyPairXWikiX509KeyPair.getFingerprint()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||