use of org.bouncycastle.asn1.ASN1Encodable in project robovm by robovm.
the class X509V2AttributeCertificate method getAttributes.
public X509Attribute[] getAttributes() {
ASN1Sequence seq = cert.getAcinfo().getAttributes();
X509Attribute[] attrs = new X509Attribute[seq.size()];
for (int i = 0; i != seq.size(); i++) {
attrs[i] = new X509Attribute((ASN1Encodable) seq.getObjectAt(i));
}
return attrs;
}
use of org.bouncycastle.asn1.ASN1Encodable in project robovm by robovm.
the class AttributeCertificateIssuer method getNames.
private Object[] getNames() {
GeneralNames name;
if (form instanceof V2Form) {
name = ((V2Form) form).getIssuerName();
} else {
name = (GeneralNames) form;
}
GeneralName[] names = name.getNames();
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()]);
}
use of org.bouncycastle.asn1.ASN1Encodable in project robovm by robovm.
the class X509Attribute method getValues.
public ASN1Encodable[] getValues() {
ASN1Set s = attr.getAttrValues();
ASN1Encodable[] values = new ASN1Encodable[s.size()];
for (int i = 0; i != s.size(); i++) {
values[i] = (ASN1Encodable) s.getObjectAt(i);
}
return values;
}
use of org.bouncycastle.asn1.ASN1Encodable in project athenz by yahoo.
the class Crypto method extractX509CSREmail.
public static String extractX509CSREmail(PKCS10CertificationRequest certReq) {
String rfc822 = null;
Attribute[] attributes = certReq.getAttributes(PKCSObjectIdentifiers.pkcs_9_at_extensionRequest);
for (Attribute attribute : attributes) {
for (ASN1Encodable value : attribute.getAttributeValues()) {
Extensions extensions = Extensions.getInstance(value);
GeneralNames gns = GeneralNames.fromExtensions(extensions, Extension.subjectAlternativeName);
for (GeneralName name : gns.getNames()) {
if (name.getTagNo() == GeneralName.rfc822Name) {
rfc822 = (((DERIA5String) name.getName()).getString());
break;
}
}
}
}
return rfc822;
}
use of org.bouncycastle.asn1.ASN1Encodable in project athenz by yahoo.
the class Crypto method extractX509CSRDnsNames.
public static List<String> extractX509CSRDnsNames(PKCS10CertificationRequest certReq) {
List<String> dnsNames = new ArrayList<>();
Attribute[] attributes = certReq.getAttributes(PKCSObjectIdentifiers.pkcs_9_at_extensionRequest);
for (Attribute attribute : attributes) {
for (ASN1Encodable value : attribute.getAttributeValues()) {
Extensions extensions = Extensions.getInstance(value);
GeneralNames gns = GeneralNames.fromExtensions(extensions, Extension.subjectAlternativeName);
for (GeneralName name : gns.getNames()) {
if (name.getTagNo() == GeneralName.dNSName) {
dnsNames.add(((DERIA5String) name.getName()).getString());
}
}
}
}
return dnsNames;
}
Aggregations