本文整理汇总了Java中org.bouncycastle.cert.X509CRLHolder类的典型用法代码示例。如果您正苦于以下问题:Java X509CRLHolder类的具体用法?Java X509CRLHolder怎么用?Java X509CRLHolder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
X509CRLHolder类属于org.bouncycastle.cert包,在下文中一共展示了X509CRLHolder类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertHolders
import org.bouncycastle.cert.X509CRLHolder; //导入依赖的package包/类
private CollectionCertStoreParameters convertHolders(JcaX509CertificateConverter certificateConverter, JcaX509CRLConverter crlConverter)
throws CertificateException, CRLException
{
List jcaObjs = new ArrayList(certs.size() + crls.size());
for (Iterator it = certs.iterator(); it.hasNext();)
{
jcaObjs.add(certificateConverter.getCertificate((X509CertificateHolder)it.next()));
}
for (Iterator it = crls.iterator(); it.hasNext();)
{
jcaObjs.add(crlConverter.getCRL((X509CRLHolder)it.next()));
}
return new CollectionCertStoreParameters(jcaObjs);
}
示例2: getCRLs
import org.bouncycastle.cert.X509CRLHolder; //导入依赖的package包/类
Store getCRLs(ASN1Set crlSet)
{
if (crlSet != null)
{
List crlList = new ArrayList(crlSet.size());
for (Enumeration en = crlSet.getObjects(); en.hasMoreElements();)
{
ASN1Primitive obj = ((ASN1Encodable)en.nextElement()).toASN1Primitive();
if (obj instanceof ASN1Sequence)
{
crlList.add(new X509CRLHolder(CertificateList.getInstance(obj)));
}
}
return new CollectionStore(crlList);
}
return new CollectionStore(new ArrayList());
}
示例3: getCRLsFromStore
import org.bouncycastle.cert.X509CRLHolder; //导入依赖的package包/类
static List getCRLsFromStore(Store crlStore)
throws CMSException
{
List certs = new ArrayList();
try
{
for (Iterator it = crlStore.getMatches(null).iterator(); it.hasNext();)
{
X509CRLHolder c = (X509CRLHolder)it.next();
certs.add(c.toASN1Structure());
}
return certs;
}
catch (ClassCastException e)
{
throw new CMSException("error processing certs", e);
}
}
示例4: getCRLs
import org.bouncycastle.cert.X509CRLHolder; //导入依赖的package包/类
/**
* Return the CRLs stored in the underlying OriginatorInfo object.
*
* @return a Store of X509CRLHolder objects.
*/
public Store getCRLs()
{
ASN1Set crlSet = originatorInfo.getCRLs();
if (crlSet != null)
{
List crlList = new ArrayList(crlSet.size());
for (Enumeration en = crlSet.getObjects(); en.hasMoreElements();)
{
ASN1Primitive obj = ((ASN1Encodable)en.nextElement()).toASN1Primitive();
if (obj instanceof ASN1Sequence)
{
crlList.add(new X509CRLHolder(CertificateList.getInstance(obj)));
}
}
return new CollectionStore(crlList);
}
return new CollectionStore(new ArrayList());
}
示例5: generateCrl
import org.bouncycastle.cert.X509CRLHolder; //导入依赖的package包/类
private X509CRL generateCrl(X509Certificate ca, PrivateKey caPrivateKey, X509Certificate... revoked) throws Exception {
X509v2CRLBuilder builder = new X509v2CRLBuilder(
new X500Name(ca.getSubjectDN().getName()),
new Date()
);
for (X509Certificate certificate : revoked) {
builder.addCRLEntry(certificate.getSerialNumber(), new Date(), CRLReason.privilegeWithdrawn);
}
JcaContentSignerBuilder contentSignerBuilder =
new JcaContentSignerBuilder("SHA256WithRSAEncryption");
contentSignerBuilder.setProvider("BC");
X509CRLHolder crlHolder = builder.build(contentSignerBuilder.build(caPrivateKey));
JcaX509CRLConverter converter = new JcaX509CRLConverter();
converter.setProvider("BC");
return converter.getCRL(crlHolder);
}
示例6: generateCRL
import org.bouncycastle.cert.X509CRLHolder; //导入依赖的package包/类
private File generateCRL(X509Certificate cert) throws CRLException, NoSuchAlgorithmException, SignatureException, InvalidKeyException, IOException, OperatorCreationException {
X500Name issuer = new X500Name("CN=ca");
Date thisUpdate = new Date();
X509v2CRLBuilder gen = new X509v2CRLBuilder(issuer, thisUpdate);
gen.setNextUpdate(new Date(System.currentTimeMillis() + 60000));
if (cert != null) {
gen.addCRLEntry(cert.getSerialNumber(), new Date(System.currentTimeMillis() - 1000), CRLReason.keyCompromise);
}
ContentSigner sigGen = new JcaContentSignerBuilder("SHA1withRSA").setProvider("BC").build(credential.getPrivateKey());
X509CRLHolder crl = gen.build(sigGen);
final File crlFile = File.createTempFile("test", "test");
crlFile.deleteOnExit();
FileOutputStream fos = new FileOutputStream(crlFile);
IOUtils.write(crl.getEncoded(), fos);
fos.close();
return crlFile;
}
示例7: generateCRL
import org.bouncycastle.cert.X509CRLHolder; //导入依赖的package包/类
private File generateCRL(X509Certificate cert) throws CRLException, NoSuchAlgorithmException, SignatureException, InvalidKeyException, IOException, OperatorCreationException {
X500Name issuer = new X500Name("CN=ca");
Date thisUpdate = new Date();
X509v2CRLBuilder gen = new X509v2CRLBuilder(issuer, thisUpdate);
gen.setNextUpdate(new Date(System.currentTimeMillis() + 60000));
if (cert != null) {
gen.addCRLEntry(cert.getSerialNumber(), new Date(System.currentTimeMillis() - 1000), CRLReason.keyCompromise);
}
ContentSigner sigGen = new JcaContentSignerBuilder("SHA1withRSA").setProvider("BC").build(cred.getPrivateKey());
X509CRLHolder crl = gen.build(sigGen);
final File crlFile = File.createTempFile("test", "test");
crlFile.deleteOnExit();
FileOutputStream fos = new FileOutputStream(crlFile);
IOUtils.write(crl.getEncoded(), fos);
fos.close();
return crlFile;
}
示例8: getCrl
import org.bouncycastle.cert.X509CRLHolder; //导入依赖的package包/类
private SignedData getCrl(X509Ca ca, BigInteger serialNumber)
throws FailInfoException, OperationException {
if (!control.supportGetCrl()) {
throw FailInfoException.BAD_REQUEST;
}
CertificateList crl = ca.getBcCurrentCrl();
if (crl == null) {
throw FailInfoException.BAD_REQUEST;
}
CMSSignedDataGenerator cmsSignedDataGen = new CMSSignedDataGenerator();
cmsSignedDataGen.addCRL(new X509CRLHolder(crl));
CMSSignedData signedData;
try {
signedData = cmsSignedDataGen.generate(new CMSAbsentContent());
} catch (CMSException ex) {
LogUtil.error(LOG, ex, "could not generate CMSSignedData");
throw new OperationException(ErrorCode.SYSTEM_FAILURE, ex);
}
return SignedData.getInstance(signedData.toASN1Structure().getContent());
}
示例9: getCRLs
import org.bouncycastle.cert.X509CRLHolder; //导入依赖的package包/类
public Store getCRLs()
throws CMSException
{
populateCertCrlSets();
ASN1Set crlSet = _crlSet;
if (crlSet != null)
{
List crlList = new ArrayList(crlSet.size());
for (Enumeration en = crlSet.getObjects(); en.hasMoreElements();)
{
ASN1Primitive obj = ((ASN1Encodable)en.nextElement()).toASN1Primitive();
if (obj instanceof ASN1Sequence)
{
crlList.add(new X509CRLHolder(CertificateList.getInstance(obj)));
}
}
return new CollectionStore(crlList);
}
return new CollectionStore(new ArrayList());
}
示例10: getCRLs
import org.bouncycastle.cert.X509CRLHolder; //导入依赖的package包/类
public Store getCRLs()
{
ASN1Set crlSet = signedData.getCRLs();
if (crlSet != null)
{
List crlList = new ArrayList(crlSet.size());
for (Enumeration en = crlSet.getObjects(); en.hasMoreElements();)
{
ASN1Primitive obj = ((ASN1Encodable)en.nextElement()).toASN1Primitive();
if (obj instanceof ASN1Sequence)
{
crlList.add(new X509CRLHolder(CertificateList.getInstance(obj)));
}
}
return new CollectionStore(crlList);
}
return new CollectionStore(new ArrayList());
}
示例11: checkCRL
import org.bouncycastle.cert.X509CRLHolder; //导入依赖的package包/类
private void checkCRL(
int id,
byte[] bytes)
{
String dump = "";
try
{
X509CRLHolder crlHolder = new X509CRLHolder(bytes);
}
catch (Exception e)
{
fail(dump + System.getProperty("line.separator") + getName() + ": "+ id + " failed - exception " + e.toString());
}
}