iaik.utils
Class PemOutputStream

java.lang.Object
  |
  +--java.io.OutputStream
        |
        +--java.io.FilterOutputStream
              |
              +--iaik.utils.Base64OutputStream
                    |
                    +--iaik.utils.PemOutputStream

public class PemOutputStream
extends Base64OutputStream

This stream can be used to convert a binary DER output stream to a PEM style base64 encoded output stream. The result written to the underlying stream will look something like:

 -----BEGIN RSA PRIVATE KEY-----
 Base64 encoded data
 -----END RSA PRIVATE KEY-----
 
All lines will be terminated by '\n'.

Version:
File Revision 11

Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
PemOutputStream(OutputStream out, String firstLine, String lastLine)
          Creates a new PemOutputStream.
 
Method Summary
 void flush()
          Flushes the stream and writes the last line.
 
Methods inherited from class iaik.utils.Base64OutputStream
getLineBreak, setLineBreak, write, write
 
Methods inherited from class java.io.FilterOutputStream
close, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PemOutputStream

public PemOutputStream(OutputStream out,
                       String firstLine,
                       String lastLine)
                throws IOException
Creates a new PemOutputStream.
Parameters:
out - a stream of DER encoded data
firstLine - the first line in the stream to write
lastLine - the last line in the stream to write
Throws:
IOException - if occurs an I/O error while writing the first line
Method Detail

flush

public void flush()
           throws IOException
Flushes the stream and writes the last line. This methos also ensures that flush() is only called for one time to avoid writing the last line for several times.
Overrides:
flush in class Base64OutputStream
Throws:
IOException - if there occurs an I/O error

This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note).

IAIK-JCE 3.1 with IAIK-JCE CC Core 3.1, (c) 1997-2004 IAIK