本文整理了Java中org.bouncycastle.asn1.x509.GeneralName.getTagNo()
方法的一些代码示例,展示了GeneralName.getTagNo()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GeneralName.getTagNo()
方法的具体详情如下:
包路径:org.bouncycastle.asn1.x509.GeneralName
类名称:GeneralName
方法名:getTagNo
暂无
代码示例来源:origin: apache/cloudstack
if (gns != null && gns.getNames() != null && gns.getNames().length > 0) {
for (final GeneralName name : gns.getNames()) {
if (name.getTagNo() == GeneralName.dNSName) {
dnsNames.add(name.getName().toString());
if (name.getTagNo() == GeneralName.iPAddress) {
final InetAddress address = InetAddress.getByAddress(DatatypeConverter.parseHexBinary(name.getName().toString().substring(1)));
ipAddresses.add(address.toString().replace("/", ""));
代码示例来源:origin: apache/pdfbox
if (genName.getTagNo() == GeneralName.uniformResourceIdentifier)
代码示例来源:origin: org.xwiki.commons/xwiki-commons-crypto-pkix
/**
* Create a new instance from a Bouncy Castle general name.
*
* @param name the Bouncy Castle general name.
*/
public X509DirectoryName(GeneralName name)
{
super(X500Name.getInstance(name.getName()));
if (name.getTagNo() != GeneralName.directoryName) {
throw new IllegalArgumentException("Incompatible general name: " + name.getTagNo());
}
}
代码示例来源:origin: org.xwiki.commons/xwiki-commons-crypto-pkix
/**
* Create a new instance from a Bouncy Castle general name.
*
* @param name the Bouncy Castle general name.
*/
public X509Rfc822Name(GeneralName name)
{
this(DERIA5String.getInstance(name.getName()).getString());
if (name.getTagNo() != GeneralName.rfc822Name) {
throw new IllegalArgumentException("Incompatible general name: " + name.getTagNo());
}
}
代码示例来源:origin: org.xwiki.commons/xwiki-commons-crypto-pkix
/**
* Create a new instance from a Bouncy Castle general name.
*
* @param name the Bouncy Castle general name.
*/
public X509URI(GeneralName name)
{
this(DERIA5String.getInstance(name.getName()).getString());
if (name.getTagNo() != GeneralName.uniformResourceIdentifier) {
throw new IllegalArgumentException("Incompatible general name: " + name.getTagNo());
}
}
代码示例来源:origin: org.xwiki.commons/xwiki-commons-crypto-pkix
/**
* Create a new instance from a Bouncy Castle general name.
*
* @param name the Bouncy Castle general name.
*/
public X509IpAddress(GeneralName name)
{
if (name.getTagNo() != GeneralName.iPAddress) {
throw new IllegalArgumentException("Incompatible general name: " + name.getTagNo());
}
this.ipAddress = DEROctetString.getInstance(name.getName()).getOctets();
}
代码示例来源:origin: org.xwiki.commons/xwiki-commons-crypto-pkix
/**
* Create a new instance from a Bouncy Castle general name.
*
* @param name the Bouncy Castle general name.
*/
public X509DnsName(GeneralName name)
{
if (name.getTagNo() != GeneralName.dNSName) {
throw new IllegalArgumentException("Incompatible general name: " + name.getTagNo());
}
this.domain = DERIA5String.getInstance(name.getName()).getString();
}
代码示例来源:origin: eu.eu-emi.security/canl
/**
* Returns the URL inside the proxy tracing data structure.
*
* @return The URL in String format.
*/
public String getURL()
{
if (name.getTagNo() != GeneralName.uniformResourceIdentifier)
return null;
DERIA5String ia5String = (DERIA5String) name.getName();
return ia5String.getString();
}
代码示例来源:origin: org.xipki/ca-server
private static X500Name getX500Sender(PKIHeader reqHeader) {
GeneralName requestSender = reqHeader.getSender();
if (requestSender.getTagNo() != GeneralName.directoryName) {
return null;
}
return (X500Name) requestSender.getName();
}
代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on
private Object[] getNames(GeneralName[] names)
{
List l = new ArrayList(names.length);
for (int i = 0; i != names.length; i++)
{
if (names[i].getTagNo() == GeneralName.directoryName)
{
try
{
l.add(new X500Principal(
((ASN1Encodable)names[i].getName()).toASN1Primitive().getEncoded()));
}
catch (IOException e)
{
throw new RuntimeException("badly formed Name object");
}
}
}
return l.toArray(new Object[l.size()]);
}
代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on
/**
* Constructor.
* @param roleAuthority the role authority of this RoleSyntax.
* @param roleName the role name of this RoleSyntax.
*/
public RoleSyntax(
GeneralNames roleAuthority,
GeneralName roleName)
{
if(roleName == null ||
roleName.getTagNo() != GeneralName.uniformResourceIdentifier ||
((ASN1String)roleName.getName()).getString().equals(""))
{
throw new IllegalArgumentException("the role name MUST be non empty and MUST " +
"use the URI option of GeneralName");
}
this.roleAuthority = roleAuthority;
this.roleName = roleName;
}
代码示例来源:origin: com.yahoo.vespa/security-utils
SubjectAlternativeName(GeneralName bcGeneralName) {
this.type = Type.fromTag(bcGeneralName.getTagNo());
this.value = getValue(bcGeneralName);
}
代码示例来源:origin: redfish64/TinyTravelTracker
/**
* Constructor.
* @param roleAuthority the role authority of this RoleSyntax.
* @param roleName the role name of this RoleSyntax.
*/
public RoleSyntax(
GeneralNames roleAuthority,
GeneralName roleName)
{
if(roleName == null ||
roleName.getTagNo() != GeneralName.uniformResourceIdentifier ||
((ASN1String)roleName.getName()).getString().equals(""))
{
throw new IllegalArgumentException("the role name MUST be non empty and MUST " +
"use the URI option of GeneralName");
}
this.roleAuthority = roleAuthority;
this.roleName = roleName;
}
代码示例来源:origin: esig/dss
private static String parseGn(GeneralName gn) {
try {
if (GeneralName.uniformResourceIdentifier == gn.getTagNo()) {
ASN1String str = (ASN1String) ((DERTaggedObject) gn.toASN1Primitive()).getObject();
return str.getString();
}
} catch (Exception e) {
LOG.warn("Unable to parse GN " + gn, e);
}
return null;
}
代码示例来源:origin: org.xipki.shells/ocsp-client-shell
public static List<String> extractOcspUrls(AuthorityInformationAccess aia)
throws CertificateEncodingException {
AccessDescription[] accessDescriptions = aia.getAccessDescriptions();
List<AccessDescription> ocspAccessDescriptions = new LinkedList<>();
for (AccessDescription accessDescription : accessDescriptions) {
if (accessDescription.getAccessMethod().equals(X509ObjectIdentifiers.id_ad_ocsp)) {
ocspAccessDescriptions.add(accessDescription);
}
}
final int n = ocspAccessDescriptions.size();
List<String> ocspUris = new ArrayList<>(n);
for (int i = 0; i < n; i++) {
GeneralName accessLocation = ocspAccessDescriptions.get(i).getAccessLocation();
if (accessLocation.getTagNo() == GeneralName.uniformResourceIdentifier) {
String ocspUri = ((ASN1String) accessLocation.getName()).getString();
ocspUris.add(ocspUri);
}
}
return ocspUris;
}
代码示例来源:origin: edu.vt.middleware/vt-crypt
/**
* Creates a {@link GeneralName} object from DER data.
*
* @param enc DER encoded general names data.
*
* @return General name.
*/
public static GeneralName createGeneralName(final DEREncodable enc)
{
final org.bouncycastle.asn1.x509.GeneralName name =
org.bouncycastle.asn1.x509.GeneralName.getInstance(enc);
return
new GeneralName(
name.getName().toString(),
GeneralNameType.fromTagNumber(name.getTagNo()));
}
代码示例来源:origin: com.yahoo.vespa/security-utils
private String getValue(GeneralName bcGeneralName) {
ASN1Encodable name = bcGeneralName.getName();
switch (bcGeneralName.getTagNo()) {
case GeneralName.rfc822Name:
case GeneralName.dNSName:
case GeneralName.uniformResourceIdentifier:
return DERIA5String.getInstance(name).getString();
case GeneralName.directoryName:
return X500Name.getInstance(name).toString();
default:
return name.toString();
}
}
代码示例来源:origin: com.tomitribe.tribestream/tribestream-container
private String getSubjectAlternativeNames(final X509Certificate certificate, final int index, final int type) {
final byte[] extVal = certificate.getExtensionValue(Extension.issuerAlternativeName.getId());
if (extVal == null) {
return null;
}
try {
final Enumeration<?> it = DERSequence.getInstance(X509ExtensionUtil.fromExtensionValue(extVal)).getObjects();
int i = index;
while (it.hasMoreElements()) {
if (index == i++) {
final GeneralName genName = GeneralName.getInstance(it.nextElement());
if (genName.getTagNo() == type) {
return ASN1String.class.cast(genName.getName()).getString();
}
}
}
} catch (final IOException e) {
// no-op
}
return null;
}
代码示例来源:origin: esig/dss
private String getUrl(DistributionPointName distributionPoint) {
if ((distributionPoint != null) && (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();
return str.getString();
}
}
}
}
return null;
}
代码示例来源:origin: org.xipki/ca-server
@Override
protected boolean intendsMe(GeneralName requestRecipient) {
if (requestRecipient == null) {
return false;
}
if (getSender().equals(requestRecipient)) {
return true;
}
if (requestRecipient.getTagNo() == GeneralName.directoryName) {
X500Name x500Name = X500Name.getInstance(requestRecipient.getName());
if (x500Name.equals(caManager.getSignerWrapper(getResponderName()).getSubjectAsX500Name())) {
return true;
}
}
return false;
} // method intendsMe
内容来源于网络,如有侵权,请联系作者删除!