org.glite.slcs.pki
Class CertificateRequest

java.lang.Object
  extended by org.glite.slcs.pki.CertificateRequest

public class CertificateRequest
extends java.lang.Object

CertificateRequest is a wrapper class for a PKCS10 object and the methods to read and store as PEM format.

Version:
$Revision: 1.2 $
Author:
Valery Tschopp

Constructor Summary
CertificateRequest(CertificateKeys keys, java.security.Principal principal)
          Creates a certificate request for the given keys and principal (DN).
CertificateRequest(CertificateKeys keys, java.lang.String subject)
          Creates a certificate request for the given keys and subject (DN).
CertificateRequest(CertificateKeys keys, java.lang.String subject, java.util.List certificateExtensions)
          Creates a certificate request for the given keys, subject and extensions.
CertificateRequest(PKCS10 pkcs10)
          Creates a certificate request with the given PKCS10 object.
 
Method Summary
 java.util.List getCertificateExtensions()
          Returns a List of certificate extensions contained in the certificate request.
 byte[] getDEREncoded()
           
 java.lang.String getPEMEncoded()
           
 java.security.Principal getPrincipal()
           
static CertificateRequest loadPEM(java.io.File file)
           
static CertificateRequest readPEM(java.io.Reader reader)
           
 void storePEM(java.io.File file)
           
 void storePEM(java.lang.String filename)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CertificateRequest

public CertificateRequest(CertificateKeys keys,
                          java.security.Principal principal)
                   throws java.security.GeneralSecurityException
Creates a certificate request for the given keys and principal (DN).

Parameters:
keys - The CertificateKeys
principal - The certificate request principal (DN).
Throws:
java.security.GeneralSecurityException - If an error occurs while creating the object.

CertificateRequest

public CertificateRequest(CertificateKeys keys,
                          java.lang.String subject)
                   throws java.security.GeneralSecurityException
Creates a certificate request for the given keys and subject (DN).

Parameters:
keys - The CertificateKeys
subject - The certificate request subject (DN).
Throws:
java.security.GeneralSecurityException - If an error occurs while creating the object.

CertificateRequest

public CertificateRequest(CertificateKeys keys,
                          java.lang.String subject,
                          java.util.List certificateExtensions)
                   throws java.security.GeneralSecurityException
Creates a certificate request for the given keys, subject and extensions.

Parameters:
keys - The CertificateKeys
subject - The certificate request subject (DN).
extensions - An List of certificate extensions.
Throws:
java.security.GeneralSecurityException - If an error occurs while creating the object.
See Also:
CertificateExtension

CertificateRequest

public CertificateRequest(PKCS10 pkcs10)
Creates a certificate request with the given PKCS10 object.

Parameters:
pkcs10 - The PKCS10 object.
Method Detail

getCertificateExtensions

public java.util.List getCertificateExtensions()
Returns a List of certificate extensions contained in the certificate request.

Returns:
The List of CertificateExtension

getPrincipal

public java.security.Principal getPrincipal()
Returns:
the certificate request principal (subject)

getPEMEncoded

public java.lang.String getPEMEncoded()
Returns:
The PKCS#10 PEM encoded string.

getDEREncoded

public byte[] getDEREncoded()
Returns:
PKCS#10 DER encoded byte array

storePEM

public void storePEM(java.lang.String filename)
              throws java.io.IOException
Parameters:
filename -
Throws:
java.io.IOException

storePEM

public void storePEM(java.io.File file)
              throws java.io.IOException
Parameters:
file -
Throws:
java.io.IOException

loadPEM

public static CertificateRequest loadPEM(java.io.File file)
                                  throws java.io.IOException,
                                         java.security.GeneralSecurityException
Parameters:
file -
Returns:
Throws:
java.io.IOException
java.security.GeneralSecurityException

readPEM

public static CertificateRequest readPEM(java.io.Reader reader)
                                  throws java.io.IOException,
                                         java.security.GeneralSecurityException
Parameters:
reader -
Returns:
Throws:
java.io.IOException
java.security.GeneralSecurityException