本文整理汇总了Java中org.bouncycastle.asn1.x509.AccessDescription.getAccessMethod方法的典型用法代码示例。如果您正苦于以下问题:Java AccessDescription.getAccessMethod方法的具体用法?Java AccessDescription.getAccessMethod怎么用?Java AccessDescription.getAccessMethod使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bouncycastle.asn1.x509.AccessDescription
的用法示例。
在下文中一共展示了AccessDescription.getAccessMethod方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extractAuthorityInformationAccess
import org.bouncycastle.asn1.x509.AccessDescription; //导入方法依赖的package包/类
public static void extractAuthorityInformationAccess(List<String> OCSPUrl,
DERObject aiaExt) {
AuthorityInformationAccess aia = AuthorityInformationAccess
.getInstance(aiaExt);
AccessDescription[] accessDescriptions = aia.getAccessDescriptions();
DERObjectIdentifier OCSPOid = new DERObjectIdentifier(
"1.3.6.1.5.5.7.48.1"); //$NON-NLS-1$
for (AccessDescription accessDescription : accessDescriptions) {
GeneralName generalName = accessDescription.getAccessLocation();
String nextName = generalName.getName().toString();
DERObjectIdentifier acessMethod = accessDescription
.getAccessMethod();
if (acessMethod.equals(OCSPOid)) {
OCSPUrl.add(nextName);
}
}
}
示例2: extractAuthorityInformationAccess
import org.bouncycastle.asn1.x509.AccessDescription; //导入方法依赖的package包/类
public static void extractAuthorityInformationAccess(List<String> OCSPUrl,
ASN1Primitive aiaExt) {
AuthorityInformationAccess aia = AuthorityInformationAccess
.getInstance(aiaExt);
AccessDescription[] accessDescriptions = aia.getAccessDescriptions();
DERObjectIdentifier OCSPOid = new DERObjectIdentifier(
"1.3.6.1.5.5.7.48.1"); //$NON-NLS-1$
for (AccessDescription accessDescription : accessDescriptions) {
GeneralName generalName = accessDescription.getAccessLocation();
String nextName = generalName.getName().toString();
DERObjectIdentifier acessMethod = accessDescription
.getAccessMethod();
if (acessMethod.equals(OCSPOid)) {
OCSPUrl.add(nextName);
}
}
}
示例3: extractAuthorityInformationAccess
import org.bouncycastle.asn1.x509.AccessDescription; //导入方法依赖的package包/类
public static void extractAuthorityInformationAccess(List<String> OCSPUrl,
ASN1Primitive aiaExt) {
AuthorityInformationAccess aia = AuthorityInformationAccess.getInstance(aiaExt);
AccessDescription[] accessDescriptions = aia.getAccessDescriptions();
DERObjectIdentifier OCSPOid = new DERObjectIdentifier(
"1.3.6.1.5.5.7.48.1"); //$NON-NLS-1$
for (AccessDescription accessDescription : accessDescriptions) {
GeneralName generalName = accessDescription.getAccessLocation();
String nextName = generalName.getName().toString();
ASN1ObjectIdentifier acessMethod = accessDescription.getAccessMethod();
if (acessMethod.equals(OCSPOid)) {
OCSPUrl.add(nextName);
}
}
}
示例4: createSubjectInfoAccess
import org.bouncycastle.asn1.x509.AccessDescription; //导入方法依赖的package包/类
private static ASN1Sequence createSubjectInfoAccess(Extensions requestedExtensions,
Map<ASN1ObjectIdentifier, Set<GeneralNameMode>> modes)
throws BadCertTemplateException {
if (modes == null) {
return null;
}
ASN1Encodable extValue = requestedExtensions.getExtensionParsedValue(
Extension.subjectInfoAccess);
if (extValue == null) {
return null;
}
ASN1Sequence reqSeq = ASN1Sequence.getInstance(extValue);
int size = reqSeq.size();
ASN1EncodableVector vec = new ASN1EncodableVector();
for (int i = 0; i < size; i++) {
AccessDescription ad = AccessDescription.getInstance(reqSeq.getObjectAt(i));
ASN1ObjectIdentifier accessMethod = ad.getAccessMethod();
Set<GeneralNameMode> generalNameModes = modes.get(accessMethod);
if (generalNameModes == null) {
throw new BadCertTemplateException("subjectInfoAccess.accessMethod "
+ accessMethod.getId() + " is not allowed");
}
GeneralName accessLocation = X509CertprofileUtil.createGeneralName(
ad.getAccessLocation(), generalNameModes);
vec.add(new AccessDescription(accessMethod, accessLocation));
} // end for
return vec.size() > 0 ? new DERSequence(vec) : null;
}
示例5: getAuthorityInformationAccessStringValue
import org.bouncycastle.asn1.x509.AccessDescription; //导入方法依赖的package包/类
private String getAuthorityInformationAccessStringValue(byte[] value) throws IOException {
// @formatter:off
/*
* AuthorityInfoAccessSyntax ::= ASN1Sequence SIZE (1..MAX) OF
* AccessDescription
*
* AccessDescription ::= ASN1Sequence { accessMethod OBJECT IDENTIFIER,
* accessLocation GeneralName }
*/
// @formatter:on
StringBuilder sb = new StringBuilder();
AuthorityInformationAccess authorityInfoAccess = AuthorityInformationAccess.getInstance(value);
int accessDesc = 0;
for (AccessDescription accessDescription : authorityInfoAccess.getAccessDescriptions()) {
accessDesc++;
// Convert OID to access method
ASN1ObjectIdentifier accessMethod = accessDescription.getAccessMethod();
AccessMethodType accessMethodType = AccessMethodType.resolveOid(accessMethod.getId());
String accessMethodStr = null;
if (accessMethodType != null) {
accessMethodStr = accessMethodType.friendly();
} else {
// Unrecognised Access Method OID
accessMethodStr = ObjectIdUtil.toString(accessMethod);
}
GeneralName accessLocation = accessDescription.getAccessLocation();
String accessLocationStr = GeneralNameUtil.toString(accessLocation);
sb.append(MessageFormat.format(res.getString("AuthorityInformationAccess"), accessDesc));
sb.append(NEWLINE);
sb.append(INDENT);
sb.append(MessageFormat.format(res.getString("AccessMethod"), accessMethodStr));
sb.append(NEWLINE);
sb.append(INDENT);
sb.append(res.getString("AccessLocation"));
sb.append(NEWLINE);
sb.append(INDENT.toString(2));
sb.append(accessLocationStr);
sb.append(NEWLINE);
}
return sb.toString();
}
示例6: getSubjectInformationAccessStringValue
import org.bouncycastle.asn1.x509.AccessDescription; //导入方法依赖的package包/类
private String getSubjectInformationAccessStringValue(byte[] value) throws IOException {
// @formatter:off
/*
* SubjectInfoAccessSyntax ::= ASN1Sequence SIZE (1..MAX) OF
* AccessDescription
*
* AccessDescription ::= ASN1Sequence { accessMethod OBJECT IDENTIFIER,
* accessLocation GeneralName }
*/
// @formatter:on
StringBuilder sb = new StringBuilder();
SubjectInfoAccess subjectInfoAccess = SubjectInfoAccess.getInstance(value);
int accessDesc = 0;
for (AccessDescription accessDescription : subjectInfoAccess.getAccessDescriptionList()) {
accessDesc++;
// Convert OID to access method
ASN1ObjectIdentifier accessMethod = accessDescription.getAccessMethod();
AccessMethodType accessMethodType = AccessMethodType.resolveOid(accessMethod.getId());
String accessMethodStr = null;
if (accessMethodType != null) {
accessMethodStr = accessMethodType.friendly();
}
// Unrecognised Access Method OID
else {
accessMethodStr = ObjectIdUtil.toString(accessMethod);
}
GeneralName accessLocation = accessDescription.getAccessLocation();
String accessLocationStr = GeneralNameUtil.toString(accessLocation);
sb.append(MessageFormat.format(res.getString("SubjectInformationAccess"), accessDesc));
sb.append(NEWLINE);
sb.append(INDENT);
sb.append(MessageFormat.format(res.getString("AccessMethod"), accessMethodStr));
sb.append(NEWLINE);
sb.append(INDENT);
sb.append(res.getString("AccessLocation"));
sb.append(NEWLINE);
sb.append(INDENT);
sb.append(INDENT);
sb.append(accessLocationStr);
sb.append(NEWLINE);
}
return sb.toString();
}
示例7: checkExtensionSubjectInfoAccess
import org.bouncycastle.asn1.x509.AccessDescription; //导入方法依赖的package包/类
private void checkExtensionSubjectInfoAccess(StringBuilder failureMsg, byte[] extensionValue,
Extensions requestedExtensions, ExtensionControl extControl) {
Map<ASN1ObjectIdentifier, Set<GeneralNameMode>> conf =
certProfile.subjectInfoAccessModes();
if (conf == null) {
failureMsg.append("extension is present but not expected; ");
return;
}
ASN1Encodable requestExtValue = null;
if (requestedExtensions != null) {
requestExtValue = requestedExtensions.getExtensionParsedValue(
Extension.subjectInfoAccess);
}
if (requestExtValue == null) {
failureMsg.append("extension is present but not expected; ");
return;
}
ASN1Sequence requestSeq = ASN1Sequence.getInstance(requestExtValue);
ASN1Sequence certSeq = ASN1Sequence.getInstance(extensionValue);
int size = requestSeq.size();
if (certSeq.size() != size) {
addViolation(failureMsg, "size of GeneralNames", certSeq.size(), size);
return;
}
for (int i = 0; i < size; i++) {
AccessDescription ad = AccessDescription.getInstance(requestSeq.getObjectAt(i));
ASN1ObjectIdentifier accessMethod = ad.getAccessMethod();
Set<GeneralNameMode> generalNameModes = conf.get(accessMethod);
if (generalNameModes == null) {
failureMsg.append("accessMethod in requestedExtension ");
failureMsg.append(accessMethod.getId()).append(" is not allowed; ");
continue;
}
AccessDescription certAccessDesc = AccessDescription.getInstance(
certSeq.getObjectAt(i));
ASN1ObjectIdentifier certAccessMethod = certAccessDesc.getAccessMethod();
boolean bo = (accessMethod == null) ? (certAccessMethod == null)
: accessMethod.equals(certAccessMethod);
if (!bo) {
addViolation(failureMsg, "accessMethod",
(certAccessMethod == null) ? "null" : certAccessMethod.getId(),
(accessMethod == null) ? "null" : accessMethod.getId());
continue;
}
GeneralName accessLocation;
try {
accessLocation = createGeneralName(ad.getAccessLocation(), generalNameModes);
} catch (BadCertTemplateException ex) {
failureMsg.append("invalid requestedExtension: ").append(ex.getMessage());
failureMsg.append("; ");
continue;
}
GeneralName certAccessLocation = certAccessDesc.getAccessLocation();
if (!certAccessLocation.equals(accessLocation)) {
failureMsg.append("accessLocation does not match the requested one; ");
}
}
}