Rice Pastry API

org.mpisws.p2p.pki.x509
Class CAToolImpl

java.lang.Object
  extended by org.mpisws.p2p.pki.x509.CAToolImpl
All Implemented Interfaces:
CATool

public class CAToolImpl
extends java.lang.Object
implements CATool


Field Summary
static java.lang.String CA_STORE_CERT
           
static java.lang.String CA_STORE_PRIVATE
           
static java.lang.String CA_STORE_PUBLIC
           
static java.lang.String DEFAULT_SIGNATURE_ALGORITHM
           
 
Constructor Summary
CAToolImpl(java.security.cert.X509Certificate cert, java.security.KeyPair caPair)
           
 
Method Summary
static Tuple<java.security.cert.X509Certificate,java.security.KeyPair> generateNewCA(java.lang.String CN, java.util.Date expiryDate)
           
static java.security.cert.X509Certificate generateNewCA(java.lang.String CN, java.util.Date startDate, java.util.Date expiryDate, long serialNumber, java.security.KeyPair keyPair, java.lang.String signatureAlgorithm)
           
static CAToolImpl getCATool(java.lang.String CN, char[] pw)
           
 java.security.cert.X509Certificate getCertificate()
           
static void main(java.lang.String[] args)
          -p CApassword -ca CAname -cn newCN
 java.security.cert.X509Certificate sign(java.lang.String CN, java.security.PublicKey key)
           
 java.security.cert.X509Certificate sign(java.lang.String CN, java.security.PublicKey publicKey, java.util.Date expiryDate, long serialNumber)
           
static java.security.cert.X509Certificate sign(java.lang.String CN, java.security.PublicKey publicKey, java.util.Date expiryDate, long serialNumber, java.security.cert.X509Certificate caCert, java.security.PrivateKey privateKey)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SIGNATURE_ALGORITHM

public static final java.lang.String DEFAULT_SIGNATURE_ALGORITHM
See Also:
Constant Field Values

CA_STORE_PRIVATE

public static final java.lang.String CA_STORE_PRIVATE
See Also:
Constant Field Values

CA_STORE_PUBLIC

public static final java.lang.String CA_STORE_PUBLIC
See Also:
Constant Field Values

CA_STORE_CERT

public static final java.lang.String CA_STORE_CERT
See Also:
Constant Field Values
Constructor Detail

CAToolImpl

public CAToolImpl(java.security.cert.X509Certificate cert,
                  java.security.KeyPair caPair)
Method Detail

getCertificate

public java.security.cert.X509Certificate getCertificate()
Specified by:
getCertificate in interface CATool

getCATool

public static CAToolImpl getCATool(java.lang.String CN,
                                   char[] pw)
                            throws java.security.KeyStoreException,
                                   java.security.NoSuchProviderException,
                                   java.security.NoSuchAlgorithmException,
                                   java.security.cert.CertificateException,
                                   java.io.FileNotFoundException,
                                   java.io.IOException,
                                   java.security.UnrecoverableKeyException,
                                   java.security.InvalidKeyException,
                                   java.lang.IllegalStateException,
                                   java.security.SignatureException,
                                   java.security.InvalidAlgorithmParameterException
Parameters:
CN - only used when generating a new CA
pw -
Returns:
Throws:
java.security.KeyStoreException
java.security.NoSuchProviderException
java.security.NoSuchAlgorithmException
java.security.cert.CertificateException
java.io.FileNotFoundException
java.io.IOException
java.security.UnrecoverableKeyException
java.security.InvalidKeyException
java.lang.IllegalStateException
java.security.SignatureException
java.security.InvalidAlgorithmParameterException

generateNewCA

public static Tuple<java.security.cert.X509Certificate,java.security.KeyPair> generateNewCA(java.lang.String CN,
                                                                                            java.util.Date expiryDate)
                                                                                     throws java.security.cert.CertificateEncodingException,
                                                                                            java.security.InvalidKeyException,
                                                                                            java.lang.IllegalStateException,
                                                                                            java.security.NoSuchProviderException,
                                                                                            java.security.NoSuchAlgorithmException,
                                                                                            java.security.SignatureException,
                                                                                            java.security.InvalidAlgorithmParameterException
Throws:
java.security.cert.CertificateEncodingException
java.security.InvalidKeyException
java.lang.IllegalStateException
java.security.NoSuchProviderException
java.security.NoSuchAlgorithmException
java.security.SignatureException
java.security.InvalidAlgorithmParameterException

generateNewCA

public static java.security.cert.X509Certificate generateNewCA(java.lang.String CN,
                                                               java.util.Date startDate,
                                                               java.util.Date expiryDate,
                                                               long serialNumber,
                                                               java.security.KeyPair keyPair,
                                                               java.lang.String signatureAlgorithm)
                                                        throws java.security.cert.CertificateEncodingException,
                                                               java.security.InvalidKeyException,
                                                               java.lang.IllegalStateException,
                                                               java.security.NoSuchProviderException,
                                                               java.security.NoSuchAlgorithmException,
                                                               java.security.SignatureException
Parameters:
CN - common name
startDate -
expiryDate -
serialNumber -
keyPair -
Returns:
the CA cert
Throws:
java.security.SignatureException
java.security.NoSuchAlgorithmException
java.security.NoSuchProviderException
java.lang.IllegalStateException
java.security.InvalidKeyException
java.security.cert.CertificateEncodingException

sign

public java.security.cert.X509Certificate sign(java.lang.String CN,
                                               java.security.PublicKey key)
                                        throws java.security.cert.CertificateParsingException,
                                               java.security.cert.CertificateEncodingException,
                                               java.security.InvalidKeyException,
                                               java.lang.IllegalStateException,
                                               java.security.NoSuchProviderException,
                                               java.security.NoSuchAlgorithmException,
                                               java.security.SignatureException
Specified by:
sign in interface CATool
Throws:
java.security.cert.CertificateParsingException
java.security.cert.CertificateEncodingException
java.security.InvalidKeyException
java.lang.IllegalStateException
java.security.NoSuchProviderException
java.security.NoSuchAlgorithmException
java.security.SignatureException

sign

public static java.security.cert.X509Certificate sign(java.lang.String CN,
                                                      java.security.PublicKey publicKey,
                                                      java.util.Date expiryDate,
                                                      long serialNumber,
                                                      java.security.cert.X509Certificate caCert,
                                                      java.security.PrivateKey privateKey)
                                               throws java.security.cert.CertificateParsingException,
                                                      java.security.cert.CertificateEncodingException,
                                                      java.security.InvalidKeyException,
                                                      java.lang.IllegalStateException,
                                                      java.security.NoSuchProviderException,
                                                      java.security.NoSuchAlgorithmException,
                                                      java.security.SignatureException
Throws:
java.security.cert.CertificateParsingException
java.security.cert.CertificateEncodingException
java.security.InvalidKeyException
java.lang.IllegalStateException
java.security.NoSuchProviderException
java.security.NoSuchAlgorithmException
java.security.SignatureException

sign

public java.security.cert.X509Certificate sign(java.lang.String CN,
                                               java.security.PublicKey publicKey,
                                               java.util.Date expiryDate,
                                               long serialNumber)
                                        throws java.security.cert.CertificateParsingException,
                                               java.security.cert.CertificateEncodingException,
                                               java.security.InvalidKeyException,
                                               java.lang.IllegalStateException,
                                               java.security.NoSuchProviderException,
                                               java.security.NoSuchAlgorithmException,
                                               java.security.SignatureException
Specified by:
sign in interface CATool
Throws:
java.security.cert.CertificateParsingException
java.security.cert.CertificateEncodingException
java.security.InvalidKeyException
java.lang.IllegalStateException
java.security.NoSuchProviderException
java.security.NoSuchAlgorithmException
java.security.SignatureException

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
-p CApassword -ca CAname -cn newCN

Parameters:
args -
Throws:
java.lang.Exception

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection