Java Code Examples for org.bouncycastle.asn1.DERTaggedObject#getTagNo()
The following examples show how to use
org.bouncycastle.asn1.DERTaggedObject#getTagNo() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OcspRef.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
private String getResponderIdByName() { RespID responderId = this.ocsp.getResponderId(); ResponderID responderIdAsASN1Object = responderId.toASN1Primitive(); DERTaggedObject derTaggedObject = (DERTaggedObject)responderIdAsASN1Object.toASN1Primitive(); if (2 == derTaggedObject.getTagNo()) { return null; } else { ASN1Primitive derObject = derTaggedObject.getObject(); X500Name name = X500Name.getInstance(derObject); return RFC2253Parser.normalize(name.toString()); } }
Example 2
Source File: OcspRef.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
private byte[] getResponderIdByKey() { ResponderID responderID = this.ocsp.getResponderId().toASN1Primitive(); DERTaggedObject derTaggedObject = (DERTaggedObject)responderID.toASN1Primitive(); if (2 == derTaggedObject.getTagNo()) { ASN1OctetString keyHashOctetString = (ASN1OctetString)derTaggedObject.getObject(); return keyHashOctetString.getOctets(); } else { return new byte[0]; } }
Example 3
Source File: OcspRef.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
private String getResponderIdByName() { RespID responderId = this.ocsp.getResponderId(); ResponderID responderIdAsASN1Object = responderId.toASN1Primitive(); DERTaggedObject derTaggedObject = (DERTaggedObject)responderIdAsASN1Object.toASN1Primitive(); if (2 == derTaggedObject.getTagNo()) { return null; } else { ASN1Primitive derObject = derTaggedObject.getObject(); X500Name name = X500Name.getInstance(derObject); return RFC2253Parser.normalize(name.toString()); } }
Example 4
Source File: OcspRef.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
private byte[] getResponderIdByKey() { ResponderID responderID = this.ocsp.getResponderId().toASN1Primitive(); DERTaggedObject derTaggedObject = (DERTaggedObject)responderID.toASN1Primitive(); if (2 == derTaggedObject.getTagNo()) { ASN1OctetString keyHashOctetString = (ASN1OctetString)derTaggedObject.getObject(); return keyHashOctetString.getOctets(); } else { return new byte[0]; } }
Example 5
Source File: OcspRef.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
private String getResponderIdByName() { RespID responderId = this.ocsp.getResponderId(); ResponderID responderIdAsASN1Object = responderId.toASN1Primitive(); DERTaggedObject derTaggedObject = (DERTaggedObject)responderIdAsASN1Object.toASN1Primitive(); if (2 == derTaggedObject.getTagNo()) { return null; } else { ASN1Primitive derObject = derTaggedObject.getObject(); X500Name name = X500Name.getInstance(derObject); return RFC2253Parser.normalize(name.toString()); } }
Example 6
Source File: OcspRef.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
private byte[] getResponderIdByKey() { ResponderID responderID = this.ocsp.getResponderId().toASN1Primitive(); DERTaggedObject derTaggedObject = (DERTaggedObject)responderID.toASN1Primitive(); if (2 == derTaggedObject.getTagNo()) { ASN1OctetString keyHashOctetString = (ASN1OctetString)derTaggedObject.getObject(); return keyHashOctetString.getOctets(); } else { return new byte[0]; } }
Example 7
Source File: OcspRef.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
private String getResponderIdByName() { RespID responderId = this.ocsp.getResponderId(); ResponderID responderIdAsASN1Object = responderId.toASN1Primitive(); DERTaggedObject derTaggedObject = (DERTaggedObject)responderIdAsASN1Object.toASN1Primitive(); if (2 == derTaggedObject.getTagNo()) { return null; } else { ASN1Primitive derObject = derTaggedObject.getObject(); X500Name name = X500Name.getInstance(derObject); return RFC2253Parser.normalize(name.toString()); } }
Example 8
Source File: OcspRef.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
private byte[] getResponderIdByKey() { ResponderID responderID = this.ocsp.getResponderId().toASN1Primitive(); DERTaggedObject derTaggedObject = (DERTaggedObject)responderID.toASN1Primitive(); if (2 == derTaggedObject.getTagNo()) { ASN1OctetString keyHashOctetString = (ASN1OctetString)derTaggedObject.getObject(); return keyHashOctetString.getOctets(); } else { return new byte[0]; } }
Example 9
Source File: OcspRef.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
private String getResponderIdByName() { RespID responderId = this.ocsp.getResponderId(); ResponderID responderIdAsASN1Object = responderId.toASN1Primitive(); DERTaggedObject derTaggedObject = (DERTaggedObject)responderIdAsASN1Object.toASN1Primitive(); if (2 == derTaggedObject.getTagNo()) { return null; } else { ASN1Primitive derObject = derTaggedObject.getObject(); X500Name name = X500Name.getInstance(derObject); return RFC2253Parser.normalize(name.toString()); } }
Example 10
Source File: OcspRef.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
private byte[] getResponderIdByKey() { ResponderID responderID = this.ocsp.getResponderId().toASN1Primitive(); DERTaggedObject derTaggedObject = (DERTaggedObject)responderID.toASN1Primitive(); if (2 == derTaggedObject.getTagNo()) { ASN1OctetString keyHashOctetString = (ASN1OctetString)derTaggedObject.getObject(); return keyHashOctetString.getOctets(); } else { return new byte[0]; } }
Example 11
Source File: X509Ext.java From portecle with GNU General Public License v2.0 | 5 votes |
/** * Get Policy Constraints (2.5.29.36) extension value as a string. * * <pre> * PolicyConstraints ::= SEQUENCE { * requireExplicitPolicy [0] SkipCerts OPTIONAL, * inhibitPolicyMapping [1] SkipCerts OPTIONAL } * SkipCerts ::= INTEGER (0..MAX) * </pre> * * @param bValue The octet string value * @return Extension value as a string * @throws IOException If an I/O problem occurs */ private String getPolicyConstraintsStringValue(byte[] bValue) throws IOException { // Get sequence of policy constraint ASN1Sequence policyConstraints = (ASN1Sequence) ASN1Primitive.fromByteArray(bValue); StringBuilder strBuff = new StringBuilder(); for (int i = 0, len = policyConstraints.size(); i < len; i++) { DERTaggedObject policyConstraint = (DERTaggedObject) policyConstraints.getObjectAt(i); ASN1Integer skipCerts = new ASN1Integer(((DEROctetString) policyConstraint.getObject()).getOctets()); int iSkipCerts = skipCerts.getValue().intValue(); switch (policyConstraint.getTagNo()) { case 0: // Require Explicit Policy Skip Certs if (strBuff.length() != 0) { strBuff.append("<br><br>"); } strBuff.append(MessageFormat.format(RB.getString("RequireExplicitPolicy"), iSkipCerts)); break; case 1: // Inhibit Policy Mapping Skip Certs if (strBuff.length() != 0) { strBuff.append("<br><br>"); } strBuff.append(MessageFormat.format(RB.getString("InhibitPolicyMapping"), iSkipCerts)); break; } } return strBuff.toString(); }
Example 12
Source File: CertificateAuthority.java From DeviceConnect-Android with MIT License | 4 votes |
/** * 証明書署名要求から Subject Alternative Names (SANs) を取得する. * * @param request 証明書署名要求 * @return SubjectAlternativeNamesを示す {@link GeneralNames} オブジェクト * @throws IOException 解析に失敗した場合 */ private GeneralNames parseSANs(final PKCS10CertificationRequest request) throws IOException { List<ASN1Encodable> generalNames = new ArrayList<>(); CertificationRequestInfo info = request.getCertificationRequestInfo(); ASN1Set attributes = info.getAttributes(); for (int i = 0; i < attributes.size(); i++) { DEREncodable extensionRequestObj = attributes.getObjectAt(i); if (!(extensionRequestObj instanceof DERSequence)) { continue; } DERSequence extensionRequest = (DERSequence) extensionRequestObj; if (extensionRequest.size() != 2) { continue; } DEREncodable idObj = extensionRequest.getObjectAt(0); DEREncodable contentObj = extensionRequest.getObjectAt(1); if (!(idObj instanceof ASN1ObjectIdentifier && contentObj instanceof DERSet)) { continue; } ASN1ObjectIdentifier id = (ASN1ObjectIdentifier) idObj; DERSet content = (DERSet) contentObj; if (!id.getId().equals("1.2.840.113549.1.9.14")) { continue; } if (content.size() < 1) { continue; } DEREncodable extensionsObj = content.getObjectAt(0); if (!(extensionsObj instanceof DERSequence)) { continue; } DERSequence extensions = (DERSequence) extensionsObj; for (int k = 0; k < extensions.size(); k++) { DEREncodable extensionObj = extensions.getObjectAt(k); if (!(extensionObj instanceof DERSequence)) { continue; } DERSequence extension = (DERSequence) extensionObj; if (extension.size() != 2) { continue; } DEREncodable extensionIdObj = extension.getObjectAt(0); DEREncodable extensionContentObj = extension.getObjectAt(1); if (!(extensionIdObj instanceof ASN1ObjectIdentifier)) { continue; } ASN1ObjectIdentifier extensionId = (ASN1ObjectIdentifier) extensionIdObj; if (extensionId.getId().equals("2.5.29.17")) { DEROctetString san = (DEROctetString) extensionContentObj; ASN1StreamParser sanParser = new ASN1StreamParser(san.parser().getOctetStream()); DEREncodable namesObj = sanParser.readObject().getDERObject(); if (namesObj instanceof DERSequence) { DERSequence names = (DERSequence) namesObj; for (int m = 0; m < names.size(); m++) { DEREncodable nameObj = names.getObjectAt(m); if (nameObj instanceof DERTaggedObject) { DERTaggedObject name = (DERTaggedObject) nameObj; switch (name.getTagNo()) { case GeneralName.dNSName: generalNames.add(new GeneralName(GeneralName.dNSName, DERIA5String.getInstance(name, false))); break; case GeneralName.iPAddress: generalNames.add(new GeneralName(GeneralName.iPAddress, DEROctetString.getInstance(name, true))); break; } } } } } } } if (generalNames.size() > 0) { return new GeneralNames(new DERSequence(generalNames.toArray(new ASN1Encodable[0]))); } return null; }