eu.emi.security.authn.x509.helpers
Class PKCS8DERReader

java.lang.Object
  extended by java.io.Reader
      extended by java.io.BufferedReader
          extended by org.bouncycastle.util.io.pem.PemReader
              extended by org.bouncycastle.openssl.PEMReader
                  extended by eu.emi.security.authn.x509.helpers.PKCS8DERReader
All Implemented Interfaces:
Closeable, Readable

public class PKCS8DERReader
extends PEMReader

This class extends the PEMReader class from the BC library. It is modified to read DER input, not the PEM (it can be considered a smart-hack) as otherwise BC's parsers code would need to be copied. It supports reading of the PKCS8 private key in DER form. It is assumed that the key is encrypted if a password is provided.

This class interface is the readObject method.

This implementation overrides the PemReader readPemObject method to actually read the DER. The Reader used by the PemReader is not used.

Author:
K. Benedyczak

Field Summary
protected  InputStream is
           
protected  PasswordFinder myPFinder
           
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
PKCS8DERReader(InputStream is)
           
PKCS8DERReader(InputStream is, PasswordFinder pFinder)
           
 
Method Summary
 PemObject readPemObject()
          Generate BC's PemObject from the input stream.
 
Methods inherited from class org.bouncycastle.openssl.PEMReader
readObject
 
Methods inherited from class java.io.BufferedReader
close, mark, markSupported, read, read, readLine, ready, reset, skip
 
Methods inherited from class java.io.Reader
read, read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

is

protected InputStream is

myPFinder

protected PasswordFinder myPFinder
Constructor Detail

PKCS8DERReader

public PKCS8DERReader(InputStream is,
                      PasswordFinder pFinder)

PKCS8DERReader

public PKCS8DERReader(InputStream is)
Method Detail

readPemObject

public PemObject readPemObject()
                        throws IOException
Generate BC's PemObject from the input stream. The object's type is fixed to encrypted or plain private key.

Overrides:
readPemObject in class PemReader
Returns:
the parsed PEM object
Throws:
IOException


Copyright © 2012-2013 European Middleware Initiative. All Rights Reserved.