| Method from sun.security.provider.X509Factory Detail: |
public CRL engineGenerateCRL(InputStream is) throws CRLException {
if (is == null) {
// clear the cache (for debugging)
crlCache.clear();
throw new CRLException("Missing input stream");
}
try {
if (is.markSupported() == false) {
// consume the entire input stream
byte[] totalBytes;
totalBytes = getTotalBytes(new BufferedInputStream(is));
is = new ByteArrayInputStream(totalBytes);
}
byte[] encoding = readSequence(is);
if (encoding != null) {
X509CRLImpl crl = (X509CRLImpl)getFromCache(crlCache, encoding);
if (crl != null) {
return crl;
}
crl = new X509CRLImpl(encoding);
addToCache(crlCache, crl.getEncodedInternal(), crl);
return crl;
} else {
X509CRLImpl crl;
// determine if binary or Base64 encoding. If Base64 encoding,
// the CRL must be bounded at the beginning by
// "-----BEGIN".
if (isBase64(is)) {
// Base64
byte[] data = base64_to_binary(is);
crl = new X509CRLImpl(data);
} else {
// binary
crl = new X509CRLImpl(new DerValue(is));
}
return intern(crl);
}
} catch (IOException ioe) {
throw new CRLException(ioe.getMessage());
}
}
Generates an X.509 certificate revocation list (CRL) object and
initializes it with the data read from the given input stream
is. |
public Collection engineGenerateCRLs(InputStream is) throws CRLException {
if (is == null) {
throw new CRLException("Missing input stream");
}
try {
if (is.markSupported() == false) {
// consume the entire input stream
is = new ByteArrayInputStream
(getTotalBytes(new BufferedInputStream(is)));
}
return parseX509orPKCS7CRL(is);
} catch (IOException ioe) {
throw new CRLException(ioe.getMessage());
}
}
Returns a (possibly empty) collection view of X.509 CRLs read
from the given input stream is. |
public CertPath engineGenerateCertPath(InputStream inStream) throws CertificateException {
if (inStream == null) {
throw new CertificateException("Missing input stream");
}
try {
if (inStream.markSupported() == false) {
// consume the entire input stream
byte[] totalBytes;
totalBytes = getTotalBytes(new BufferedInputStream(inStream));
inStream = new ByteArrayInputStream(totalBytes);
}
// determine if binary or Base64 encoding. If Base64 encoding,
// each certificate must be bounded at the beginning by
// "-----BEGIN".
if (isBase64(inStream)) {
// Base64
byte[] data = base64_to_binary(inStream);
return new X509CertPath(new ByteArrayInputStream(data));
} else {
return new X509CertPath(inStream);
}
} catch (IOException ioe) {
throw new CertificateException(ioe.getMessage());
}
}
Generates a CertPath object and initializes it with
the data read from the InputStream inStream. The data
is assumed to be in the default encoding. |
public CertPath engineGenerateCertPath(List certificates) throws CertificateException {
return(new X509CertPath(certificates));
}
Generates a CertPath object and initializes it with
a List of Certificates.
The certificates supplied must be of a type supported by the
CertificateFactory. They will be copied out of the supplied
List object. |
public CertPath engineGenerateCertPath(InputStream inStream,
String encoding) throws CertificateException {
if (inStream == null) {
throw new CertificateException("Missing input stream");
}
try {
if (inStream.markSupported() == false) {
// consume the entire input stream
byte[] totalBytes;
totalBytes = getTotalBytes(new BufferedInputStream(inStream));
inStream = new ByteArrayInputStream(totalBytes);
}
// determine if binary or Base64 encoding. If Base64 encoding,
// each certificate must be bounded at the beginning by
// "-----BEGIN".
if (isBase64(inStream)) {
// Base64
byte[] data = base64_to_binary(inStream);
return new X509CertPath(new ByteArrayInputStream(data), encoding);
} else {
return(new X509CertPath(inStream, encoding));
}
} catch (IOException ioe) {
throw new CertificateException(ioe.getMessage());
}
}
Generates a CertPath object and initializes it with
the data read from the InputStream inStream. The data
is assumed to be in the specified encoding. |
public Certificate engineGenerateCertificate(InputStream is) throws CertificateException {
if (is == null) {
// clear the caches (for debugging)
certCache.clear();
X509CertificatePair.clearCache();
throw new CertificateException("Missing input stream");
}
try {
if (is.markSupported() == false) {
// consume the entire input stream
byte[] totalBytes;
totalBytes = getTotalBytes(new BufferedInputStream(is));
is = new ByteArrayInputStream(totalBytes);
}
byte[] encoding = readSequence(is);
if (encoding != null) {
X509CertImpl cert = (X509CertImpl)getFromCache(certCache, encoding);
if (cert != null) {
return cert;
}
cert = new X509CertImpl(encoding);
addToCache(certCache, cert.getEncodedInternal(), cert);
return cert;
} else {
X509CertImpl cert;
// determine if binary or Base64 encoding. If Base64 encoding,
// the certificate must be bounded at the beginning by
// "-----BEGIN".
if (isBase64(is)) {
// Base64
byte[] data = base64_to_binary(is);
cert = new X509CertImpl(data);
} else {
// binary
cert = new X509CertImpl(new DerValue(is));
}
return intern(cert);
}
} catch (IOException ioe) {
throw (CertificateException)new CertificateException
("Could not parse certificate: " + ioe.toString()).initCause(ioe);
}
}
Generates an X.509 certificate object and initializes it with
the data read from the input stream is. |
public Collection engineGenerateCertificates(InputStream is) throws CertificateException {
if (is == null) {
throw new CertificateException("Missing input stream");
}
try {
if (is.markSupported() == false) {
// consume the entire input stream
is = new ByteArrayInputStream
(getTotalBytes(new BufferedInputStream(is)));
}
return parseX509orPKCS7Cert(is);
} catch (IOException ioe) {
throw new CertificateException(ioe);
}
}
Returns a (possibly empty) collection view of X.509 certificates read
from the given input stream is. |
public Iterator engineGetCertPathEncodings() {
return(X509CertPath.getEncodingsStatic());
}
Returns an iteration of the CertPath encodings supported
by this certificate factory, with the default encoding first.
Attempts to modify the returned Iterator via its
remove method result in an
UnsupportedOperationException. |
public static synchronized X509CertImpl intern(X509Certificate c) throws CertificateException {
if (c == null) {
return null;
}
boolean isImpl = c instanceof X509CertImpl;
byte[] encoding;
if (isImpl) {
encoding = ((X509CertImpl)c).getEncodedInternal();
} else {
encoding = c.getEncoded();
}
X509CertImpl newC = (X509CertImpl)getFromCache(certCache, encoding);
if (newC != null) {
return newC;
}
if (isImpl) {
newC = (X509CertImpl)c;
} else {
newC = new X509CertImpl(encoding);
encoding = newC.getEncodedInternal();
}
addToCache(certCache, encoding, newC);
return newC;
}
Return an interned X509CertImpl for the given certificate.
If the given X509Certificate or X509CertImpl is already present
in the cert cache, the cached object is returned. Otherwise,
if it is a X509Certificate, it is first converted to a X509CertImpl.
Then the X509CertImpl is added to the cache and returned.
Note that all certificates created via generateCertificate(InputStream)
are already interned and this method does not need to be called.
It is useful for certificates that cannot be created via
generateCertificate() and for converting other X509Certificate
implementations to an X509CertImpl. |
public static synchronized X509CRLImpl intern(X509CRL c) throws CRLException {
if (c == null) {
return null;
}
boolean isImpl = c instanceof X509CRLImpl;
byte[] encoding;
if (isImpl) {
encoding = ((X509CRLImpl)c).getEncodedInternal();
} else {
encoding = c.getEncoded();
}
X509CRLImpl newC = (X509CRLImpl)getFromCache(crlCache, encoding);
if (newC != null) {
return newC;
}
if (isImpl) {
newC = (X509CRLImpl)c;
} else {
newC = new X509CRLImpl(encoding);
encoding = newC.getEncodedInternal();
}
addToCache(crlCache, encoding, newC);
return newC;
}
Return an interned X509CRLImpl for the given certificate.
For more information, see intern(X509Certificate). |