|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.vt.middleware.crypt.util.CryptReader
public class CryptReader
Helper class for performing I/O read operations on cryptographic data.
| Field Summary | |
|---|---|
static String |
DEFAULT_CERTIFICATE_TYPE
X.509 certificate type. |
| Constructor Summary | |
|---|---|
protected |
CryptReader()
Protected constructor of utility class. |
| Method Summary | |
|---|---|
static Certificate |
readCertificate(File certFile)
Reads a PEM or DER-encoded certificate of the default type from a file into a Certificate object. |
static Certificate |
readCertificate(File certFile,
String type)
Reads a PEM or DER-encoded certificate of the given type from a file into a Certificate object. |
static Certificate |
readCertificate(InputStream certStream)
Reads a PEM or DER-encoded certificate of the default type from an input stream into a Certificate object. |
static Certificate |
readCertificate(InputStream certStream,
String type)
Reads a PEM or DER-encoded certificate of the default type from an input stream into a Certificate object. |
static Certificate[] |
readCertificateChain(File chainFile)
Reads a certificate chain of the default certificate type from a file containing data in any of the formats supported by readCertificateChain(InputStream, String). |
static Certificate[] |
readCertificateChain(File chainFile,
String type)
Reads a certificate chain of the given type from a file containing data in any of the formats supported by readCertificateChain(InputStream,
String). |
static Certificate[] |
readCertificateChain(InputStream chainStream)
Reads a certificate chain of the default certificate type from an input stream containing data in any of the formats supported by readCertificateChain(InputStream, String). |
static Certificate[] |
readCertificateChain(InputStream chainStream,
String type)
Reads a certificate chain of the default certificate type from an input stream containing data in any of the following formats: Sequence of DER-encoded certificates Concatenation of PEM-encoded certificates PKCS#7 certificate chain |
static PrivateKey |
readPrivateKey(File keyFile)
Reads a DER-encoded private key in PKCS#8 or OpenSSL "traditional" format from a file into a PrivateKey object. |
static PrivateKey |
readPrivateKey(File keyFile,
char[] password)
Reads an encrypted private key in PKCS#8 or OpenSSL "traditional" format from a file into a PrivateKey object. |
static PrivateKey |
readPrivateKey(InputStream keyStream)
Reads a DER-encoded private key in PKCS#8 or OpenSSL "traditional" format from an input stream into a PrivateKey object. |
static PrivateKey |
readPrivateKey(InputStream keyStream,
char[] password)
Reads an encrypted private key in PKCS#8 or OpenSSL "traditional" format from a file into a PrivateKey object. |
static PublicKey |
readPublicKey(File keyFile)
Reads a DER-encoded X.509 public key from an input stream into a PublicKey object. |
static PublicKey |
readPublicKey(InputStream keyStream)
Reads a DER-encoded X.509 public key from an input stream into a PublicKey object. |
static SecretKey |
readSecretKey(File keyFile,
String algorithm)
Reads the raw bytes of a symmetric encryption key from a file. |
static SecretKey |
readSecretKey(InputStream keyStream,
String algorithm)
Reads the raw bytes of a symmetric encryption key from an input stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String DEFAULT_CERTIFICATE_TYPE
| Constructor Detail |
|---|
protected CryptReader()
| Method Detail |
|---|
public static SecretKey readSecretKey(File keyFile,
String algorithm)
throws CryptException,
IOException
keyFile - File containing key data.algorithm - Symmetric cipher algorithm for which key is used.
CryptException - On cryptography errors such as invalid formats,
unsupported ciphers, illegal settings.
IOException - On IO errors.
public static SecretKey readSecretKey(InputStream keyStream,
String algorithm)
throws CryptException,
IOException
keyStream - Stream containing key data.algorithm - Symmetric cipher algorithm for which key is used.
CryptException - On cryptography errors such as invalid formats,
unsupported ciphers, illegal settings.
IOException - On IO errors.
public static PrivateKey readPrivateKey(File keyFile)
throws CryptException,
IOException
PrivateKey object.
keyFile - Private key file.
CryptException - On key format errors.
IOException - On key read errors.
public static PrivateKey readPrivateKey(InputStream keyStream)
throws CryptException,
IOException
PrivateKey object.
keyStream - Input stream containing private key data.
CryptException - On key format errors.
IOException - On key read errors.
public static PrivateKey readPrivateKey(File keyFile,
char[] password)
throws CryptException,
IOException
PrivateKey object. Both DER and PEM encoded keys
are supported.
keyFile - Private key file.password - Password to decrypt private key.
CryptException - On key format errors.
IOException - On key read errors.
public static PrivateKey readPrivateKey(InputStream keyStream,
char[] password)
throws CryptException,
IOException
PrivateKey object. Both DER and PEM encoded keys
are supported.
keyStream - Input stream containing private key data.password - Password to decrypt private key; MUST NOT be null.
CryptException - On key format errors.
IOException - On key read errors.
public static PublicKey readPublicKey(File keyFile)
throws CryptException,
IOException
PublicKey object.
keyFile - File containing DER-encoded X.509 public key.
CryptException - On key format errors.
IOException - On key read errors.
public static PublicKey readPublicKey(InputStream keyStream)
throws CryptException,
IOException
PublicKey object.
keyStream - Input stream containing DER-encoded X.509 public key.
CryptException - On key format errors.
IOException - On key read errors.
public static Certificate readCertificate(File certFile)
throws CryptException,
IOException
Certificate object.
certFile - Path to certificate file.
CryptException - On certificate format errors.
IOException - On read errors.
public static Certificate readCertificate(File certFile,
String type)
throws CryptException,
IOException
Certificate object.
certFile - Path to certificate file.type - Type of certificate to read, e.g. X.509.
CryptException - On certificate format errors.
IOException - On read errors.
public static Certificate readCertificate(InputStream certStream)
throws CryptException,
IOException
Certificate object.
certStream - Input stream with certificate data.
CryptException - On certificate read or format errors.
IOException - On read errors.
public static Certificate readCertificate(InputStream certStream,
String type)
throws CryptException,
IOException
Certificate object.
certStream - Input stream with certificate data.type - Type of certificate to read, e.g. X.509.
IOException - On read errors.
CryptException - On certificate read or format errors.
public static Certificate[] readCertificateChain(File chainFile)
throws CryptException,
IOException
readCertificateChain(InputStream, String).
chainFile - Path to certificate chain file.
CryptException - On certificate format errors.
IOException - On read errors.
public static Certificate[] readCertificateChain(File chainFile,
String type)
throws CryptException,
IOException
readCertificateChain(InputStream,
String).
chainFile - Path to certificate chain file.type - Type of certificate to read, e.g. X.509.
CryptException - On certificate format errors.
IOException - On read errors.
public static Certificate[] readCertificateChain(InputStream chainStream)
throws CryptException,
IOException
readCertificateChain(InputStream, String).
chainStream - Stream containing certificate chain data.
CryptException - On certificate read or format errors.
IOException - On read errors.
public static Certificate[] readCertificateChain(InputStream chainStream,
String type)
throws CryptException,
IOException
chainStream - Stream containing certificate chain data.type - Type of certificate to read, e.g. X.509.
CryptException - On certificate read or format errors.
IOException - On read errors.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||