use of java.security.cert.CRL in project XobotOS by xamarin.
the class CertStoreCollectionSpi method engineGetCRLs.
public Collection engineGetCRLs(CRLSelector selector) throws CertStoreException {
List col = new ArrayList();
Iterator iter = params.getCollection().iterator();
if (selector == null) {
while (iter.hasNext()) {
Object obj = iter.next();
if (obj instanceof CRL) {
col.add(obj);
}
}
} else {
while (iter.hasNext()) {
Object obj = iter.next();
if ((obj instanceof CRL) && selector.match((CRL) obj)) {
col.add(obj);
}
}
}
return col;
}
use of java.security.cert.CRL in project jdk8u_jdk by JetBrains.
the class Pair method doPrintCRL.
private void doPrintCRL(String src, PrintStream out) throws Exception {
for (CRL crl : loadCRLs(src)) {
printCRL(crl, out);
String issuer = null;
if (caks != null) {
issuer = verifyCRL(caks, crl);
if (issuer != null) {
out.printf(rb.getString("verified.by.s.in.s"), issuer, "cacerts");
out.println();
}
}
if (issuer == null && keyStore != null) {
issuer = verifyCRL(keyStore, crl);
if (issuer != null) {
out.printf(rb.getString("verified.by.s.in.s"), issuer, "keystore");
out.println();
}
}
if (issuer == null) {
out.println(rb.getString("STAR"));
out.println(rb.getString("warning.not.verified.make.sure.keystore.is.correct"));
out.println(rb.getString("STARNN"));
}
}
}
use of java.security.cert.CRL in project nhin-d by DirectProject.
the class CRLRevocationManager method isRevoked.
/**
* {@inheritDoc}
*/
@Override
public boolean isRevoked(X509Certificate certificate) {
if (certificate == null)
return false;
final CRL crl = loadCRLs(certificate);
if (crl == null) {
final StringBuilder builder = new StringBuilder("Cannot find a CRL for certificate.").append("\r\n\tDN: ").append(certificate.getSubjectDN());
builder.append("\r\n\tSerial Number: ").append(certificate.getSerialNumber().toString(16));
LOGGER.warn(builder.toString());
return false;
}
synchronized (crl) {
if (crl.isRevoked(certificate)) {
final StringBuilder builder = new StringBuilder("Certificate is revoked by CRL ").append("\r\n\tDN: ").append(certificate.getSubjectDN());
builder.append("\r\n\tSerial Number: ").append(certificate.getSerialNumber().toString(16));
LOGGER.warn(builder.toString());
return true;
}
}
return false;
}
use of java.security.cert.CRL in project nhin-d by DirectProject.
the class CRLRevocationManager_getCrlFromUriTest method testGetCrlFromUri_emptyURI_assertNull.
public void testGetCrlFromUri_emptyURI_assertNull() {
CRL crl = CRLRevocationManager.getInstance().getCrlFromUri("");
assertNull(crl);
}
use of java.security.cert.CRL in project nhin-d by DirectProject.
the class CRLRevocationManager_writeCRLCacheFileTest method testWriteCRLCacheFile_writeToFile.
public void testWriteCRLCacheFile_writeToFile() throws Exception {
CRLRevocationManager.initCRLCacheLocation();
CRL crlToWrite = TestUtils.loadCRL("certs.crl");
String distURI = "http://localhost:8080/config";
CRLRevocationManager.getInstance().writeCRLCacheFile(distURI, (X509CRL) crlToWrite);
// make sure the file exists
File crlFile = new File(CRLRevocationManager.getCacheFileName(distURI));
assertTrue(crlFile.exists());
}
Aggregations