COM.claymoresystems.cert
Class CertRequest
java.lang.Object
COM.claymoresystems.cert.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,
java.security.PublicKey pub)
|
static java.security.KeyPair |
generateKey(java.lang.String type,
int size,
java.lang.String password,
java.io.BufferedWriter keyfile,
boolean newParams)
Generate a key pair |
static void |
main(java.lang.String[] args)
|
static byte[] |
makePKCS10Request(java.security.KeyPair p,
X509Name name)
Make a PKCS10 CSR |
static byte[] |
makeSelfSignedCert(java.security.KeyPair p,
X509Name name,
int lifetime)
Make a Self-signed cert |
static X509Name |
makeSimpleDN(java.util.Vector rdns)
|
static byte[] |
makeSPKACRequest(java.security.KeyPair p)
Make a Netscape Signed Public Key and Cert request |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CertRequest
public CertRequest()
generateKey
public static java.security.KeyPair generateKey(java.lang.String type,
int size,
java.lang.String password,
java.io.BufferedWriter keyfile,
boolean newParams)
throws java.security.NoSuchAlgorithmException,
java.security.NoSuchProviderException,
java.io.IOException
- Generate a key pair
- Parameters:
type
- DSA or RSAsize
- the lengthpassword
- the password to use to encrypted the keykeyfile
- the keyfile to store the key innewParams
- generate new parameters if using DSA--by default Sun uses fixed precomputed params
- Returns:
- the keypair
- Throws:
java.security.NoSuchAlgorithmException
- if you choose a key we don't know about
java.security.NoSuchProviderException
- internal errors
java.io.IOException
- encoding errors
makeSPKACRequest
public static byte[] makeSPKACRequest(java.security.KeyPair p)
throws java.io.IOException
- Make a Netscape Signed Public Key and Cert request
- Parameters:
p
- the keypair to make it with
- Returns:
- the SPKAC as a bytestring
- Throws:
java.io.IOException
- for errors
makePKCS10Request
public static byte[] makePKCS10Request(java.security.KeyPair p,
X509Name name)
throws java.io.IOException
- Make a PKCS10 CSR
- Parameters:
p
- the keypair to make it withname
- the subject name as an X509Name
- Returns:
- the CSR as a bytestring
- Throws:
java.io.IOException
- for errors
makeSelfSignedCert
public static byte[] makeSelfSignedCert(java.security.KeyPair p,
X509Name name,
int lifetime)
throws java.io.IOException
- Make a Self-signed cert
- Parameters:
p
- the keypair to make it withthe
- name to usethe
- lifetime in seconds
- Returns:
- the CSR as a bytestring
- Throws:
java.io.IOException
- for errors
makeSimpleDN
public static X509Name makeSimpleDN(java.util.Vector rdns)
fitSignature
protected static byte[] fitSignature(byte[] tmp,
java.security.PublicKey pub)
main
public static void main(java.lang.String[] args)
throws java.io.IOException,
java.lang.Exception
- Throws:
java.io.IOException
java.lang.Exception
Copyright (c) 1999-2001 Claymore Systems, Inc., All Rights Reserved.