edu.vt.middleware.crypt.io
Class AbstractEncodedCredentialReader<T>

java.lang.Object
  extended by edu.vt.middleware.crypt.io.AbstractEncodedCredentialReader<T>
Type Parameters:
T - Type of credential handled by this class.
All Implemented Interfaces:
CredentialReader<T>
Direct Known Subclasses:
PrivateKeyCredentialReader, PublicKeyCredentialReader

public abstract class AbstractEncodedCredentialReader<T>
extends Object
implements CredentialReader<T>

Base class for credential readers that handle credentials that can be described as a byte array.

Version:
$Revision: 2744 $
Author:
Middleware Services

Field Summary
protected static org.bouncycastle.asn1.DERObjectIdentifier DSA_ID
          DSA algorithm OID.
protected static org.bouncycastle.asn1.DERObjectIdentifier EC_ID
          EC algorithm OID.
protected  org.slf4j.Logger logger
          Logger instance.
protected static org.bouncycastle.asn1.DERObjectIdentifier RSA_ID
          RSA algorithm OID.
 
Constructor Summary
AbstractEncodedCredentialReader()
           
 
Method Summary
protected abstract  T decode(byte[] encoded)
          Decodes an encoded representation of a credential into a corresponding object.
 T read(File file)
          Reads a credential, commonly in encoded format, from the given file.
 T read(InputStream in)
          Reads a credential, commonly in encoded format, from the given input stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DSA_ID

protected static final org.bouncycastle.asn1.DERObjectIdentifier DSA_ID
DSA algorithm OID.


EC_ID

protected static final org.bouncycastle.asn1.DERObjectIdentifier EC_ID
EC algorithm OID.


RSA_ID

protected static final org.bouncycastle.asn1.DERObjectIdentifier RSA_ID
RSA algorithm OID.


logger

protected final org.slf4j.Logger logger
Logger instance.

Constructor Detail

AbstractEncodedCredentialReader

public AbstractEncodedCredentialReader()
Method Detail

read

public T read(File file)
       throws IOException,
              CryptException
Reads a credential, commonly in encoded format, from the given file.

Specified by:
read in interface CredentialReader<T>
Parameters:
file - File from which to read credential.
Returns:
Credential read from file.
Throws:
IOException - On IO exceptions.
CryptException - On cryptography errors such as invalid formats, unsupported ciphers, illegal settings.

read

public T read(InputStream in)
       throws IOException,
              CryptException
Reads a credential, commonly in encoded format, from the given input stream.

Specified by:
read in interface CredentialReader<T>
Parameters:
in - Input stream from which to read credential.
Returns:
Credential read from input stream.
Throws:
IOException - On IO exceptions.
CryptException - On cryptography errors such as invalid formats, unsupported ciphers, illegal settings.

decode

protected abstract T decode(byte[] encoded)
                     throws CryptException
Decodes an encoded representation of a credential into a corresponding object.

Parameters:
encoded - Encoded representation of credential.
Returns:
Decoded credential.
Throws:
CryptException - On decoding errors.


Copyright © 2003-2013 Virginia Tech. All Rights Reserved.