本文整理汇总了Java中org.bouncycastle.asn1.x509.IssuingDistributionPoint.getOnlySomeReasons方法的典型用法代码示例。如果您正苦于以下问题:Java IssuingDistributionPoint.getOnlySomeReasons方法的具体用法?Java IssuingDistributionPoint.getOnlySomeReasons怎么用?Java IssuingDistributionPoint.getOnlySomeReasons使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bouncycastle.asn1.x509.IssuingDistributionPoint
的用法示例。
在下文中一共展示了IssuingDistributionPoint.getOnlySomeReasons方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processCRLD
import org.bouncycastle.asn1.x509.IssuingDistributionPoint; //导入方法依赖的package包/类
protected static ReasonsMask processCRLD(
X509CRL crl,
DistributionPoint dp)
throws AnnotatedException
{
IssuingDistributionPoint idp = null;
try
{
idp = IssuingDistributionPoint.getInstance(CertPathValidatorUtilities.getExtensionValue(crl,
RFC3280CertPathUtilities.ISSUING_DISTRIBUTION_POINT));
}
catch (Exception e)
{
throw new AnnotatedException("Issuing distribution point extension could not be decoded.", e);
}
// (d) (1)
if (idp != null && idp.getOnlySomeReasons() != null && dp.getReasons() != null)
{
return new ReasonsMask(dp.getReasons()).intersect(new ReasonsMask(idp.getOnlySomeReasons()));
}
// (d) (4)
if ((idp == null || idp.getOnlySomeReasons() == null) && dp.getReasons() == null)
{
return ReasonsMask.allReasons;
}
// (d) (2) and (d)(3)
return (dp.getReasons() == null
? ReasonsMask.allReasons
: new ReasonsMask(dp.getReasons())).intersect(idp == null
? ReasonsMask.allReasons
: new ReasonsMask(idp.getOnlySomeReasons()));
}
示例2: checkCriticalExtensions
import org.bouncycastle.asn1.x509.IssuingDistributionPoint; //导入方法依赖的package包/类
protected void checkCriticalExtensions(CRLValidity validity, Collection<String> criticalExtensionsOid, byte[] issuingDistributionPointBinary) {
if (criticalExtensionsOid == null || criticalExtensionsOid.isEmpty()) {
validity.setUnknownCriticalExtension(false);
} else {
IssuingDistributionPoint issuingDistributionPoint = IssuingDistributionPoint
.getInstance(ASN1OctetString.getInstance(issuingDistributionPointBinary).getOctets());
final boolean onlyAttributeCerts = issuingDistributionPoint.onlyContainsAttributeCerts();
final boolean onlyCaCerts = issuingDistributionPoint.onlyContainsCACerts();
final boolean onlyUserCerts = issuingDistributionPoint.onlyContainsUserCerts();
final boolean indirectCrl = issuingDistributionPoint.isIndirectCRL();
ReasonFlags onlySomeReasons = issuingDistributionPoint.getOnlySomeReasons();
DistributionPointName distributionPoint = issuingDistributionPoint.getDistributionPoint();
boolean urlFound = false;
if (DistributionPointName.FULL_NAME == distributionPoint.getType()) {
final GeneralNames generalNames = (GeneralNames) distributionPoint.getName();
if ((generalNames != null) && (generalNames.getNames() != null && generalNames.getNames().length > 0)) {
for (GeneralName generalName : generalNames.getNames()) {
if (GeneralName.uniformResourceIdentifier == generalName.getTagNo()) {
ASN1String str = (ASN1String) ((DERTaggedObject) generalName.toASN1Primitive()).getObject();
validity.setUrl(str.getString());
urlFound = true;
}
}
}
}
if (!(onlyAttributeCerts && onlyCaCerts && onlyUserCerts && indirectCrl) && (onlySomeReasons == null) && urlFound) {
validity.setUnknownCriticalExtension(false);
}
}
}
示例3: getIssuingDistributionPointStringValue
import org.bouncycastle.asn1.x509.IssuingDistributionPoint; //导入方法依赖的package包/类
private String getIssuingDistributionPointStringValue(byte[] value) throws IOException {
// @formatter:off
/*
* IssuingDistributionPoint ::= ASN1Sequence {
* distributionPoint [0] DistributionPointName OPTIONAL,
* onlyContainsUserCerts [1] ASN1Boolean DEFAULT FALSE,
* onlyContainsCACerts [2] ASN1Boolean DEFAULT FALSE,
* onlySomeReasons [3] ReasonFlags OPTIONAL,
* indirectCRL [4] ASN1Boolean DEFAULT FALSE,
* onlyContainsAttributeCerts [5] ASN1Boolean DEFAULT FALSE }
*/
// @formatter:on
/*
* Getting any DEFAULTS returns a false ASN1Boolean when no value
* present which saves the bother of a null check
*/
StringBuilder sb = new StringBuilder();
IssuingDistributionPoint issuingDistributionPoint = IssuingDistributionPoint.getInstance(value);
DistributionPointName distributionPointName = issuingDistributionPoint.getDistributionPoint();
if (distributionPointName != null) { // Optional
sb.append(getDistributionPointNameString(distributionPointName, ""));
}
boolean onlyContainsUserCerts = issuingDistributionPoint.onlyContainsUserCerts();
sb.append(MessageFormat.format(res.getString("OnlyContainsUserCerts"), onlyContainsUserCerts));
sb.append(NEWLINE);
boolean onlyContainsCaCerts = issuingDistributionPoint.onlyContainsCACerts();
sb.append(MessageFormat.format(res.getString("OnlyContainsCaCerts"), onlyContainsCaCerts));
sb.append(NEWLINE);
ReasonFlags onlySomeReasons = issuingDistributionPoint.getOnlySomeReasons();
if (onlySomeReasons != null) {// Optional
sb.append(res.getString("OnlySomeReasons"));
sb.append(NEWLINE);
String[] reasonFlags = getReasonFlagsStrings(onlySomeReasons);
for (String reasonFlag : reasonFlags) {
sb.append(INDENT);
sb.append(reasonFlag);
sb.append(NEWLINE);
}
}
boolean indirectCrl = issuingDistributionPoint.isIndirectCRL();
sb.append(MessageFormat.format(res.getString("IndirectCrl"), indirectCrl));
sb.append(NEWLINE);
boolean onlyContainsAttributeCerts = issuingDistributionPoint.onlyContainsAttributeCerts();
sb.append(MessageFormat.format(res.getString("OnlyContainsAttributeCerts"), onlyContainsAttributeCerts));
sb.append(NEWLINE);
return sb.toString();
}