org.mpisws.p2p.pki.x509
Class CAToolImpl
java.lang.Object
org.mpisws.p2p.pki.x509.CAToolImpl
- All Implemented Interfaces:
- CATool
public class CAToolImpl
- extends Object
- implements CATool
|
Method Summary |
static Tuple<X509Certificate,KeyPair> |
generateNewCA(String CN,
Date expiryDate)
|
static X509Certificate |
generateNewCA(String CN,
Date startDate,
Date expiryDate,
long serialNumber,
KeyPair keyPair,
String signatureAlgorithm)
|
static CAToolImpl |
getCATool(String CN,
char[] pw)
|
X509Certificate |
getCertificate()
|
static void |
main(String[] args)
-p CApassword -ca CAname -cn newCN |
X509Certificate |
sign(String CN,
PublicKey key)
|
X509Certificate |
sign(String CN,
PublicKey publicKey,
Date expiryDate,
long serialNumber)
|
static X509Certificate |
sign(String CN,
PublicKey publicKey,
Date expiryDate,
long serialNumber,
X509Certificate caCert,
PrivateKey privateKey)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_SIGNATURE_ALGORITHM
public static final String DEFAULT_SIGNATURE_ALGORITHM
- See Also:
- Constant Field Values
CA_STORE_PRIVATE
public static final String CA_STORE_PRIVATE
- See Also:
- Constant Field Values
CA_STORE_PUBLIC
public static final String CA_STORE_PUBLIC
- See Also:
- Constant Field Values
CA_STORE_CERT
public static final String CA_STORE_CERT
- See Also:
- Constant Field Values
CAToolImpl
public CAToolImpl(X509Certificate cert,
KeyPair caPair)
getCertificate
public X509Certificate getCertificate()
- Specified by:
getCertificate in interface CATool
getCATool
public static CAToolImpl getCATool(String CN,
char[] pw)
throws KeyStoreException,
NoSuchProviderException,
NoSuchAlgorithmException,
CertificateException,
FileNotFoundException,
IOException,
UnrecoverableKeyException,
InvalidKeyException,
IllegalStateException,
SignatureException,
InvalidAlgorithmParameterException
- Parameters:
CN - only used when generating a new CApw -
- Returns:
-
- Throws:
KeyStoreException
NoSuchProviderException
NoSuchAlgorithmException
CertificateException
FileNotFoundException
IOException
UnrecoverableKeyException
InvalidKeyException
IllegalStateException
SignatureException
InvalidAlgorithmParameterException
generateNewCA
public static Tuple<X509Certificate,KeyPair> generateNewCA(String CN,
Date expiryDate)
throws CertificateEncodingException,
InvalidKeyException,
IllegalStateException,
NoSuchProviderException,
NoSuchAlgorithmException,
SignatureException,
InvalidAlgorithmParameterException
- Throws:
CertificateEncodingException
InvalidKeyException
IllegalStateException
NoSuchProviderException
NoSuchAlgorithmException
SignatureException
InvalidAlgorithmParameterException
generateNewCA
public static X509Certificate generateNewCA(String CN,
Date startDate,
Date expiryDate,
long serialNumber,
KeyPair keyPair,
String signatureAlgorithm)
throws CertificateEncodingException,
InvalidKeyException,
IllegalStateException,
NoSuchProviderException,
NoSuchAlgorithmException,
SignatureException
- Parameters:
CN - common namestartDate - expiryDate - serialNumber - keyPair -
- Returns:
- the CA cert
- Throws:
SignatureException
NoSuchAlgorithmException
NoSuchProviderException
IllegalStateException
InvalidKeyException
CertificateEncodingException
sign
public X509Certificate sign(String CN,
PublicKey key)
throws CertificateParsingException,
CertificateEncodingException,
InvalidKeyException,
IllegalStateException,
NoSuchProviderException,
NoSuchAlgorithmException,
SignatureException
- Specified by:
sign in interface CATool
- Throws:
CertificateParsingException
CertificateEncodingException
InvalidKeyException
IllegalStateException
NoSuchProviderException
NoSuchAlgorithmException
SignatureException
sign
public static X509Certificate sign(String CN,
PublicKey publicKey,
Date expiryDate,
long serialNumber,
X509Certificate caCert,
PrivateKey privateKey)
throws CertificateParsingException,
CertificateEncodingException,
InvalidKeyException,
IllegalStateException,
NoSuchProviderException,
NoSuchAlgorithmException,
SignatureException
- Throws:
CertificateParsingException
CertificateEncodingException
InvalidKeyException
IllegalStateException
NoSuchProviderException
NoSuchAlgorithmException
SignatureException
sign
public X509Certificate sign(String CN,
PublicKey publicKey,
Date expiryDate,
long serialNumber)
throws CertificateParsingException,
CertificateEncodingException,
InvalidKeyException,
IllegalStateException,
NoSuchProviderException,
NoSuchAlgorithmException,
SignatureException
- Specified by:
sign in interface CATool
- Throws:
CertificateParsingException
CertificateEncodingException
InvalidKeyException
IllegalStateException
NoSuchProviderException
NoSuchAlgorithmException
SignatureException
main
public static void main(String[] args)
throws Exception
- -p CApassword -ca CAname -cn newCN
- Parameters:
args -
- Throws:
Exception
Copyright © 2010. All Rights Reserved.