|
||||||||||
| 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(byte[] certBytes)
Reads a PEM or DER-encoded certificate of the default type from a byte array into a Certificate object. |
static Certificate |
readCertificate(byte[] certBytes,
String type)
Reads a PEM or DER-encoded certificate of the default type from a byte array into a Certificate object. |
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(byte[] chainBytes)
Reads a certificate chain of the default certificate type from a byte array containing data in any of the formats supported by readCertificateChain(InputStream, String). |
static Certificate[] |
readCertificateChain(byte[] chainBytes,
String type)
Reads a certificate chain of the given type from a byte array containing data in any of the formats supported by readCertificateChain(InputStream, String). |
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 X509CRL |
readCRL(byte[] crlBytes)
Reads a PEM or DER-encoded X.509 CRL from a byte array into an X509CRL object. |
static X509CRL |
readCRL(File crlFile)
Reads a PEM or DER-encoded X.509 CRL from a file into an X509CRL
object. |
static X509CRL |
readCRL(InputStream crlStream)
Reads a PEM or DER-encoded X.509 CRL from an input stream into an X509CRL object. |
static PrivateKey |
readPrivateKey(byte[] keyBytes)
Reads a DER-encoded private key in PKCS#8 or OpenSSL "traditional" format from a byte array into a PrivateKey object. |
static PrivateKey |
readPrivateKey(byte[] keyBytes,
char[] password)
Reads an encrypted private key in PKCS#8 or OpenSSL "traditional" format from a byte array into a PrivateKey object. |
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 an input stream into a PrivateKey object. |
static PublicKey |
readPublicKey(byte[] keyBytes)
Reads a PEM or DER-encoded X.509 public key from a byte array into a PublicKey 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 PEM or DER-encoded X.509 public key from an input stream into a PublicKey object. |
static SecretKey |
readSecretKey(byte[] keyBytes,
String algorithm)
Reads the raw bytes of a symmetric encryption key from a byte array. |
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 SecretKey readSecretKey(byte[] keyBytes,
String algorithm)
throws CryptException,
IOException
keyBytes - Byte array 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(byte[] keyBytes)
throws CryptException,
IOException
PrivateKey object.
keyBytes - Byte array 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 PrivateKey readPrivateKey(byte[] keyBytes,
char[] password)
throws CryptException,
IOException
PrivateKey object. Both DER and PEM
encoded keys are supported.
keyBytes - Byte array 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 PublicKey readPublicKey(byte[] keyBytes)
throws CryptException,
IOException
PublicKey object.
keyBytes - Byte array 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 readCertificate(byte[] certBytes)
throws CryptException,
IOException
Certificate object.
certBytes - Byte array containing certificate data.
CryptException - On certificate read or format errors.
IOException - On read errors.
public static Certificate readCertificate(byte[] certBytes,
String type)
throws CryptException,
IOException
Certificate object.
certBytes - Byte array containing 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.
public static Certificate[] readCertificateChain(byte[] chainBytes)
throws CryptException,
IOException
readCertificateChain(InputStream, String).
chainBytes - Byte array containing certificate chain data.
CryptException - On certificate format errors.
IOException - On read errors.
public static Certificate[] readCertificateChain(byte[] chainBytes,
String type)
throws CryptException,
IOException
readCertificateChain(InputStream, String).
chainBytes - Byte array containing certificate chain data.type - Type of certificate to read, e.g. X.509.
CryptException - On certificate format errors.
IOException - On read errors.
public static X509CRL readCRL(InputStream crlStream)
throws CryptException,
IOException
X509CRL object.
crlStream - Input stream with CRL data.
IOException - On read errors.
CryptException - On CRL read or format errors.
public static X509CRL readCRL(File crlFile)
throws CryptException,
IOException
X509CRL
object.
crlFile - Path to CRL file.
IOException - On read errors.
CryptException - On CRL read or format errors.
public static X509CRL readCRL(byte[] crlBytes)
throws CryptException,
IOException
X509CRL object.
crlBytes - Byte array containing CRL data.
IOException - On read errors.
CryptException - On CRL read or format errors.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||