Java Code Examples for org.bouncycastle.asn1.DERIA5String#getString()
The following examples show how to use
org.bouncycastle.asn1.DERIA5String#getString() .
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: PolicyInfo.java From signer with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void parse(ASN1Primitive primitive) { ASN1Sequence sequence1 = ASN1Object.getDERSequence(primitive); this.signingPeriod = new SigningPeriod(); this.signingPeriod.parse(sequence1.getObjectAt(0).toASN1Primitive()); int indice = 2; ASN1Primitive secondObject = sequence1.getObjectAt(1).toASN1Primitive(); if (secondObject instanceof ASN1ObjectIdentifier) { indice = 1; } if (indice == 2) { this.revocationDate = new GeneralizedTime(); this.revocationDate.parse(secondObject); } this.policyOID = new ObjectIdentifier(); this.policyOID.parse(sequence1.getObjectAt(indice).toASN1Primitive()); DERIA5String policyURI = (DERIA5String) sequence1.getObjectAt(indice + 1); this.policyURI = policyURI.getString(); ASN1Primitive policyDigest = sequence1.getObjectAt(indice + 2).toASN1Primitive(); ASN1Sequence sequence2 = ASN1Sequence.getInstance(policyDigest); DEROctetString derOctetString = (DEROctetString) sequence2.getObjectAt(1).toASN1Primitive(); ASN1Sequence sequence3 = ASN1Object.getDERSequence(sequence2.getObjectAt(0).toASN1Primitive()); ASN1ObjectIdentifier objectIdentifier = (ASN1ObjectIdentifier) sequence3.getObjectAt(0).toASN1Primitive(); AlgorithmIdentifier algorithmIdentifier = new AlgorithmIdentifier(objectIdentifier); this.policyDigest = new OtherHashAlgAndValue(algorithmIdentifier, derOctetString); }
Example 2
Source File: Spkac.java From keystore-explorer with GNU General Public License v3.0 | 5 votes |
private void decodeSpkac(byte[] der) throws SpkacException { try { ASN1Sequence signedPublicKeyAndChallenge = ASN1Sequence.getInstance(der); ASN1Sequence publicKeyAndChallenge = (ASN1Sequence) signedPublicKeyAndChallenge.getObjectAt(0); ASN1Sequence signatureAlgorithm = (ASN1Sequence) signedPublicKeyAndChallenge.getObjectAt(1); DERBitString signature = (DERBitString) signedPublicKeyAndChallenge.getObjectAt(2); ASN1ObjectIdentifier signatureAlgorithmOid = (ASN1ObjectIdentifier) signatureAlgorithm.getObjectAt(0); ASN1Sequence spki = (ASN1Sequence) publicKeyAndChallenge.getObjectAt(0); DERIA5String challenge = (DERIA5String) publicKeyAndChallenge.getObjectAt(1); ASN1Sequence publicKeyAlgorithm = (ASN1Sequence) spki.getObjectAt(0); DERBitString publicKey = (DERBitString) spki.getObjectAt(1); ASN1ObjectIdentifier publicKeyAlgorithmOid = (ASN1ObjectIdentifier) publicKeyAlgorithm.getObjectAt(0); ASN1Primitive algorithmParameters = publicKeyAlgorithm.getObjectAt(1).toASN1Primitive(); this.challenge = challenge.getString(); this.publicKey = decodePublicKeyFromBitString(publicKeyAlgorithmOid, algorithmParameters, publicKey); this.signatureAlgorithm = getSignatureAlgorithm(signatureAlgorithmOid); this.signature = signature.getBytes(); } catch (Exception ex) { throw new SpkacException(res.getString("NoDecodeSpkac.exception.message"), ex); } }
Example 3
Source File: CRLCertificateVerifier.java From oxAuth with MIT License | 5 votes |
public String getCrlUri(X509Certificate certificate) throws IOException { ASN1Primitive obj; try { obj = getExtensionValue(certificate, Extension.cRLDistributionPoints.getId()); } catch (IOException ex) { log.error("Failed to get CRL URL", ex); return null; } if (obj == null) { return null; } CRLDistPoint distPoint = CRLDistPoint.getInstance(obj); DistributionPoint[] distributionPoints = distPoint.getDistributionPoints(); for (DistributionPoint distributionPoint : distributionPoints) { DistributionPointName distributionPointName = distributionPoint.getDistributionPoint(); if (DistributionPointName.FULL_NAME != distributionPointName.getType()) { continue; } GeneralNames generalNames = (GeneralNames) distributionPointName.getName(); GeneralName[] names = generalNames.getNames(); for (GeneralName name : names) { if (name.getTagNo() != GeneralName.uniformResourceIdentifier) { continue; } DERIA5String derStr = DERIA5String.getInstance((ASN1TaggedObject) name.toASN1Primitive(), false); return derStr.getString(); } } return null; }
Example 4
Source File: OCSPCertificateVerifier.java From oxAuth with MIT License | 5 votes |
@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; }