ch.othello.openscep.internal
Class PEMWriter

java.lang.Object
  |
  +--ch.othello.openscep.internal.PEMWriter

public class PEMWriter
extends Object

util - class for PEM File output (base64 encoded)

 $Id: PEMWriter.java,v 1.11 2002/02/22 12:38:31 urut Exp $
 $Log: PEMWriter.java,v $
 Revision 1.11  2002/02/22 12:38:31  urut
 new method to write to stream
 made methods more generic, moved general stuff into seperate private methods

 Revision 1.10  2002/02/16 00:40:20  urut
 awfull lot of fixes,among them:
 - computation of transactionID for v2
 - spkac processing in cmd line client
 - new filetyp unknown for debug files
 - subject in cmd client
 - lots of fixes for v2 protocoll handling

 Revision 1.9  2002/02/14 17:17:04  urut
 insert line-breaks when encoding byte arrays (otherwise openssl can't read it)

 Revision 1.8  2002/02/12 19:33:23  urut
 replaced all println statements

 Revision 1.7  2002/02/07 17:08:50  urut
 ability to send scep request over http added

 Revision 1.6  2002/01/31 11:30:12  urut
 generateFile added

 Revision 1.5  2002/01/24 22:18:11  urut
 lots of modifications; read response (CertRep), RSA decrypt, DES-cbc decrypt,
 bouncy fix for reading SET/SEQUENCE with length=0

 Revision 1.4  2002/01/10 20:22:01  urut
 bug fixing

 Revision 1.3  2002/01/10 14:14:33  urut
 generic PEM writer

 Revision 1.2  2002/01/08 21:00:29  urut
 added javadoc header with cvs tags to every file

 

Since:
$Date: 2002/02/22 12:38:31 $
Version:
$Revision: 1.11 $
Author:
urut

Field Summary
static int FILETYPE_CERTIFICATE
           
static int FILETYPE_CERTIFICATE_REQUEST
           
static int FILETYPE_RSA_PRIVATEKEY
           
static int FILETYPE_UNKNOWN
           
static int FILETYPE_X509_CRL
           
private static int lineLength
           
 
Constructor Summary
PEMWriter()
           
 
Method Summary
static byte[] encodeByteArray(byte[] in)
           
static void generateFile(String filename, org.bouncycastle.asn1.DERObject derobject, int fileType)
           
static void generateRequestFile(OutputStream oStream, org.bouncycastle.asn1.DERObject derobject, int fileType)
           
static void generateRequestFile(String filename, byte[] out, int fileType)
           
static void generateRequestFile(String filename, org.bouncycastle.asn1.DERObject derobject, int fileType)
          write DERObject to base64 encoded file with PEM compatible header/footer information
private static String getEndFile(int fileType)
           
private static String getInitFile(int fileType)
           
private static void writeToStream(OutputStream oStream, byte[] out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILETYPE_CERTIFICATE_REQUEST

public static final int FILETYPE_CERTIFICATE_REQUEST
See Also:
Constant Field Values

FILETYPE_X509_CRL

public static final int FILETYPE_X509_CRL
See Also:
Constant Field Values

FILETYPE_CERTIFICATE

public static final int FILETYPE_CERTIFICATE
See Also:
Constant Field Values

FILETYPE_RSA_PRIVATEKEY

public static final int FILETYPE_RSA_PRIVATEKEY
See Also:
Constant Field Values

FILETYPE_UNKNOWN

public static final int FILETYPE_UNKNOWN
See Also:
Constant Field Values

lineLength

private static int lineLength
Constructor Detail

PEMWriter

public PEMWriter()
Method Detail

generateFile

public static void generateFile(String filename,
                                org.bouncycastle.asn1.DERObject derobject,
                                int fileType)
                         throws Exception
Exception

generateRequestFile

public static void generateRequestFile(String filename,
                                       org.bouncycastle.asn1.DERObject derobject,
                                       int fileType)
                                throws Exception
write DERObject to base64 encoded file with PEM compatible header/footer information

Parameters:
filename -
derobject -
fileType - possible values are: FILETYPE_CERTIFICATE_REQUEST FILETYPE_X509_CRL FILETYPE_CERTIFICATE FILETYPE_RSA_PRIVATEKEY
Throws:
IOException
Exception

generateRequestFile

public static void generateRequestFile(OutputStream oStream,
                                       org.bouncycastle.asn1.DERObject derobject,
                                       int fileType)
                                throws Exception
Exception

getEndFile

private static String getEndFile(int fileType)
                          throws Exception
Exception

getInitFile

private static String getInitFile(int fileType)
                           throws Exception
Exception

writeToStream

private static void writeToStream(OutputStream oStream,
                                  byte[] out)
                           throws Exception
Exception

generateRequestFile

public static void generateRequestFile(String filename,
                                       byte[] out,
                                       int fileType)
                                throws Exception
Exception

encodeByteArray

public static byte[] encodeByteArray(byte[] in)


ScepClient is copyright by Ueli Rutishauser + Alain Schaefer