当前位置: 首页>>代码示例>>Java>>正文


Java AccessDescription.getAccessLocation方法代码示例

本文整理汇总了Java中org.bouncycastle.asn1.x509.AccessDescription.getAccessLocation方法的典型用法代码示例。如果您正苦于以下问题:Java AccessDescription.getAccessLocation方法的具体用法?Java AccessDescription.getAccessLocation怎么用?Java AccessDescription.getAccessLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bouncycastle.asn1.x509.AccessDescription的用法示例。


在下文中一共展示了AccessDescription.getAccessLocation方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
		}
	}
}
 
开发者ID:bluecrystalsign,项目名称:signer-source,代码行数:18,代码来源:DerEncoder.java

示例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);
		}
	}
}
 
开发者ID:bluecrystalsign,项目名称:signer-source,代码行数:18,代码来源:DerEncoder.java

示例3: getAccessLocations

import org.bouncycastle.asn1.x509.AccessDescription; //导入方法依赖的package包/类
private static List<String> getAccessLocations(final CertificateToken certificate, ASN1ObjectIdentifier aiaType) {
	List<String> locationsUrls = new ArrayList<String>();
	final byte[] authInfoAccessExtensionValue = certificate.getCertificate().getExtensionValue(Extension.authorityInfoAccess.getId());
	if (null == authInfoAccessExtensionValue) {
		return locationsUrls;
	}

	try {
		ASN1Sequence asn1Sequence = DSSASN1Utils.getAsn1SequenceFromDerOctetString(authInfoAccessExtensionValue);
		AuthorityInformationAccess authorityInformationAccess = AuthorityInformationAccess.getInstance(asn1Sequence);
		AccessDescription[] accessDescriptions = authorityInformationAccess.getAccessDescriptions();
		for (AccessDescription accessDescription : accessDescriptions) {
			if (aiaType.equals(accessDescription.getAccessMethod())) {
				GeneralName gn = accessDescription.getAccessLocation();
				String location = parseGn(gn);
				if (location != null) {
					locationsUrls.add(location);
				}
			}
		}
	} catch (Exception e) {
		LOG.error("Unable to parse authorityInfoAccess", e);
	}
	return locationsUrls;
}
 
开发者ID:esig,项目名称:dss,代码行数:26,代码来源:DSSASN1Utils.java

示例4: 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);
		}
	}
}
 
开发者ID:bluecrystalsign,项目名称:signer-source,代码行数:16,代码来源:DerEncoder.java

示例5: getAccessLocation

import org.bouncycastle.asn1.x509.AccessDescription; //导入方法依赖的package包/类
private URI getAccessLocation(X509Certificate certificate,
		ASN1ObjectIdentifier accessMethod) throws IOException,
		URISyntaxException {
	byte[] authInfoAccessExtensionValue = certificate
			.getExtensionValue(Extension.authorityInfoAccess.getId());
	if (null == authInfoAccessExtensionValue) {
		return null;
	}
	AuthorityInformationAccess authorityInformationAccess;
	DEROctetString oct = (DEROctetString) (new ASN1InputStream(
			new ByteArrayInputStream(authInfoAccessExtensionValue))
			.readObject());
	authorityInformationAccess = AuthorityInformationAccess
			.getInstance(new ASN1InputStream(oct.getOctets()).readObject());
	AccessDescription[] accessDescriptions = authorityInformationAccess
			.getAccessDescriptions();
	for (AccessDescription accessDescription : accessDescriptions) {
		LOG.debug("access method: " + accessDescription.getAccessMethod());
		boolean correctAccessMethod = accessDescription.getAccessMethod()
				.equals(accessMethod);
		if (!correctAccessMethod) {
			continue;
		}
		GeneralName gn = accessDescription.getAccessLocation();
		if (gn.getTagNo() != GeneralName.uniformResourceIdentifier) {
			LOG.debug("not a uniform resource identifier");
			continue;
		}
		DERIA5String str = DERIA5String.getInstance(gn.getName());
		String accessLocation = str.getString();
		LOG.debug("access location: " + accessLocation);
		URI uri = toURI(accessLocation);
		LOG.debug("access location URI: " + uri);
		return uri;
	}
	return null;
}
 
开发者ID:e-Contract,项目名称:jtrust,代码行数:38,代码来源:OcspTrustLinker.java

示例6: getOCSPUrl

import org.bouncycastle.asn1.x509.AccessDescription; //导入方法依赖的package包/类
@SuppressWarnings({ "deprecation", "resource" })
private String getOCSPUrl(X509Certificate certificate) throws IOException {
	ASN1Primitive obj;
	try {
		obj = getExtensionValue(certificate, Extension.authorityInfoAccess.getId());
	} catch (IOException ex) {
		log.error("Failed to get OCSP URL", ex);
		return null;
	}

	if (obj == null) {
		return null;
	}

	AuthorityInformationAccess authorityInformationAccess = AuthorityInformationAccess.getInstance(obj);

	AccessDescription[] accessDescriptions = authorityInformationAccess.getAccessDescriptions();
	for (AccessDescription accessDescription : accessDescriptions) {
		boolean correctAccessMethod = accessDescription.getAccessMethod().equals(X509ObjectIdentifiers.ocspAccessMethod);
		if (!correctAccessMethod) {
			continue;
		}

		GeneralName name = accessDescription.getAccessLocation();
		if (name.getTagNo() != GeneralName.uniformResourceIdentifier) {
			continue;
		}

		DERIA5String derStr = DERIA5String.getInstance((ASN1TaggedObject) name.toASN1Primitive(), false);
		return derStr.getString();
	}

	return null;

}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:36,代码来源:OCSPCertificateVerifier.java

示例7: 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();
}
 
开发者ID:kaikramer,项目名称:keystore-explorer,代码行数:56,代码来源:X509Ext.java

示例8: 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();
}
 
开发者ID:kaikramer,项目名称:keystore-explorer,代码行数:58,代码来源:X509Ext.java

示例9: 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; ");
        }
    }
}
 
开发者ID:xipki,项目名称:xipki,代码行数:70,代码来源:ExtensionsChecker.java


注:本文中的org.bouncycastle.asn1.x509.AccessDescription.getAccessLocation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。