COM.claymoresystems.cert

Class CertRequest

public class CertRequest extends 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 KeyPairgenerateKey(String type, int size, String password, BufferedWriter keyfile, boolean newParams)
Generate a key pair
static voidmain(String[] args)
static byte[]makePKCS10Request(KeyPair p, X509Name name)
Make a PKCS10 CSR
static byte[]makeSelfSignedCert(KeyPair p, X509Name name, int lifetime)
Make a Self-signed cert
static X509NamemakeSimpleDN(Vector rdns)
static byte[]makeSPKACRequest(KeyPair p)
Make a Netscape Signed Public Key and Cert request

Method Detail

fitSignature

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

generateKey

public static KeyPair generateKey(String type, int size, String password, BufferedWriter keyfile, boolean newParams)
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

Throws: NoSuchAlgorithmException if you choose a key we don't know about NoSuchProviderException internal errors IOException encoding errors

main

public static void main(String[] args)

makePKCS10Request

public static byte[] makePKCS10Request(KeyPair p, X509Name name)
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

Throws: IOException for errors

makeSelfSignedCert

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

Parameters: p the keypair to make it with the name to use the lifetime in seconds

Returns: the CSR as a bytestring

Throws: IOException for errors

makeSimpleDN

public static X509Name makeSimpleDN(Vector rdns)

makeSPKACRequest

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

Parameters: p the keypair to make it with

Returns: the SPKAC as a bytestring

Throws: IOException for errors

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