COM.claymoresystems.cert

Class CertRequest


public class CertRequest
extends java.lang.Object

Generate various kinds of certificate signing requests.

The three main interfaces are
makeSPKACRequest()
makePKCS10Request()
makeSelfSignedCert()

You can access these in a primitive fashion through the main() function but this gives you a mostly hardcoded DN with PKCS10 and self-signed (you can choose the CN). makeSimpleDN() offers a way to construct a fairly simple DN from a simpler construct than the standard X509Name. At some point we may expose simpler functionality at the command line.

Method Summary

protected static byte[]
fitSignature(byte[] tmp, PublicKey pub)
static KeyPair
generateKey(String type, int size, String password, BufferedWriter keyfile, boolean newParams)
Generate a key pair
static void
main(String[] args)
static byte[]
makePKCS10Request(KeyPair p, X509Name name)
Make a PKCS10 CSR
static byte[]
makeSPKACRequest(KeyPair p)
Make a Netscape Signed Public Key and Cert request
static byte[]
makeSelfSignedCert(KeyPair p, X509Name name, int lifetime)
Make a Self-signed cert
static X509Name
makeSimpleDN(Vector rdns)

Method Details

fitSignature

protected static byte[] fitSignature(byte[] tmp,
                                     PublicKey pub)


generateKey

public static KeyPair generateKey(String type,
                                  int size,
                                  String password,
                                  BufferedWriter keyfile,
                                  boolean newParams)
            throws NoSuchAlgorithmException,
                   NoSuchProviderException,
                   IOException
Generate a key pair

Parameters:
type - DSA or RSA
size - the length
password - the password to use to encrypted the key
keyfile - the keyfile to store the key in
newParams - generate new parameters if using DSA--by default Sun uses fixed precomputed params

Returns:
the keypair


main

public static void main(String[] args)
            throws IOException,
                   Exception


makePKCS10Request

public static byte[] makePKCS10Request(KeyPair p,
                                       X509Name name)
            throws IOException
Make a PKCS10 CSR

Parameters:
p - the keypair to make it with
name - the subject name as an X509Name

Returns:
the CSR as a bytestring


makeSPKACRequest

public static byte[] makeSPKACRequest(KeyPair p)
            throws IOException
Make a Netscape Signed Public Key and Cert request

Parameters:
p - the keypair to make it with

Returns:
the SPKAC as a bytestring


makeSelfSignedCert

public static byte[] makeSelfSignedCert(KeyPair p,
                                        X509Name name,
                                        int lifetime)
            throws IOException
Make a Self-signed cert

Parameters:
p - the keypair to make it with

Returns:
the CSR as a bytestring


makeSimpleDN

public static X509Name makeSimpleDN(Vector rdns)


Copyright (c) 1999-2001 Claymore Systems, Inc., All Rights Reserved.