@Test public void readOCSPAccessLocationsAndStopOnceLoopDetected() { CertificateToken caTokenA = DSSUtils.loadCertificateFromBase64EncodedString("MIIGZTCCBU2gAwIBAgICP0IwDQYJKoZIhvcNAQELBQAwWTELMAkGA1UEBhMCVVMxGDAWBgNVBAoTD1UuUy4gR292ZXJubWVudDENMAsGA1UECxMERlBLSTEhMB8GA1UEAxMYRmVkZXJhbCBDb21tb24gUG9saWN5IENBMB4XDTE2MTEwODE4MjAzOFoXDTE5MTEwODE4MjAzOFowVzELMAkGA1UEBhMCVVMxGDAWBgNVBAoTD1UuUy4gR292ZXJubWVudDENMAsGA1UECxMERlBLSTEfMB0GA1UEAxMWRmVkZXJhbCBCcmlkZ2UgQ0EgMjAxNjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL6dNXlvJbX0kINuE79TUMrNHJbUHGuB8oqbD0an37fv/+1EWc6Hlm9fV7H+M6tHx4WXdzyKDhTNL3lqJxTSeFulpUs4Orjf9osL2lMRI1mfqWIykPQaTwWDPj3NmxV7kNiLoc3MuMBDn82ni74jQX0pM99ZfUDA49pzw69Dv5ZYSsKDsiriIX6Tl2r5FWmMfgxokTrwtyyBWgq9koa5hJmSmASf1MSJwpHhIVJIft0An4/5LT7y6F4KVMxPgkgvDAJeB7Yy5JMpN8xWdyF2ZhqZ8gsT4sP5O+CYHJw/9SPIhi+Py+m/XxriaDIHvbu2N4neuHD9yMmDRCsYvoZ3EjkCAwEAAaOCAzcwggMzMA8GA1UdEwEB/wQFMAMBAf8wggFBBgNVHSAEggE4MIIBNDAMBgpghkgBZQMCAQMGMAwGCmCGSAFlAwIBAwcwDAYKYIZIAWUDAgEDCDAMBgpghkgBZQMCAQMNMAwGCmCGSAFlAwIBAxAwDAYKYIZIAWUDAgEDATAMBgpghkgBZQMCAQMCMAwGCmCGSAFlAwIBAw4wDAYKYIZIAWUDAgEDDzAMBgpghkgBZQMCAQMRMAwGCmCGSAFlAwIBAxIwDAYKYIZIAWUDAgEDEzAMB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nv0BxU3zw1OzujKoD6y7mb5EsunGXVi7Rltw1LJVZCaXC40DfDVEqx4hVd0JdoFluBBYs8XZEdve1sobkEAfNUhn5LMCklqGb55jSPSdXDN5HJ3t3vJ5xjXbeWbsTAh0Ta3Z7pZA5osMKx39VwXItWYyaBfCxOLRb9Nu+wEqrxpld83pGEJpzvR7SWfBirfVYa3E1kHizjTsM1GY7pjtHGwM2iYgJUuJwW32HHPxwlMwAr4zxG5ev/VUxGhmZw9bbkbLvmLvXXEGb6BQ=="); assertTrue(caTokenA.isSignedBy(caTokenB)); assertTrue(caTokenB.isSignedBy(caTokenA)); List<String> ocspAccessLocations = DSSASN1Utils.getOCSPAccessLocations(caTokenA); assertNotNull(ocspAccessLocations); }
public static List<String> getOCSPAccessLocations(final CertificateToken certificate) { return getAccessLocations(certificate, X509ObjectIdentifiers.id_ad_ocsp); }
DSSASN1Utils { public static List<String> getOCSPAccessLocations(final CertificateToken certificate) { return getAccessLocations(certificate, X509ObjectIdentifiers.id_ad_ocsp); } }
DSSASN1Utils { public static List<String> getOCSPAccessLocations(final CertificateToken certificate) { return getAccessLocations(certificate, X509ObjectIdentifiers.id_ad_ocsp); } private  DSSASN1Utils(); }
DSSASN1Utils { public static List<String> getOCSPAccessLocations(final CertificateToken certificate) { return getAccessLocations(certificate, X509ObjectIdentifiers.id_ad_ocsp); } private  DSSASN1Utils(); @SuppressWarnings("unchecked") static T toASN1Primitive(final byte[] bytes); static byte[] getDEREncoded(ASN1Encodable asn1Encodable); static byte[] getBEREncoded(ASN1Encodable asn1Encodable); static byte[] getEncoded(BasicOCSPResp basicOCSPResp); static Date toDate(final ASN1GeneralizedTime asn1Date); static String toString(final ASN1OctetString value); static byte[] getEncoded(final TimeStampToken timeStampToken); static byte[] getEncoded(final CMSSignedData cmsSignedData); static byte[] getDEREncoded(final TimeStampToken timeStampToken); static byte[] getDEREncoded(final CMSSignedData data); static byte[] getDEREncoded(final TimestampBinary timestampBinary); static byte[] getDEREncoded(final byte[] bytes); static ASN1Sequence getAsn1SequenceFromDerOctetString(byte[] bytes); static byte[] getAsn1SignaturePolicyDigest(DigestAlgorithm digestAlgorithm, byte[] policyBytes); static AlgorithmIdentifier getAlgorithmIdentifier(final ASN1Sequence atsHashIndexValue); static AlgorithmIdentifier getAlgorithmIdentifier(DigestAlgorithm digestAlgorithm); static ASN1Sequence getCertificatesHashIndex(final ASN1Sequence atsHashIndexValue); static ASN1Sequence getCRLHashIndex(final ASN1Sequence atsHashIndexValue); static ASN1Sequence getUnsignedAttributesHashIndex(final ASN1Sequence atsHashIndexValue); @SuppressWarnings("unchecked") static List<DEROctetString> getDEROctetStrings(final ASN1Sequence asn1Sequence); static boolean hasIdPkixOcspNoCheckExtension(CertificateToken token); static List<CertificatePolicy> getCertificatePolicies(final CertificateToken certToken); static List<String> getQCStatementsIdList(final CertificateToken certToken); static List<String> getQCTypesIdList(final CertificateToken certToken); static List<String> getQCLegislations(CertificateToken certToken); static byte[] getSki(final CertificateToken certificateToken); static byte[] getSki(final CertificateToken certificateToken, boolean computeIfMissing); static byte[] getAuthorityKeyIdentifier(CertificateToken certificateToken); static byte[] computeSkiFromCert(final CertificateToken certificateToken); static byte[] computeSkiFromCertPublicKey(final PublicKey publicKey); static boolean isSkiEqual(final byte[] ski, final CertificateToken certificateToken); static List<String> getCAAccessLocations(final CertificateToken certificate); static List<String> getOCSPAccessLocations(final CertificateToken certificate); static List<String> getCrlUrls(final CertificateToken certificateToken); static boolean isOCSPSigning(CertificateToken certToken); static boolean isExtendedKeyUsagePresent(CertificateToken certToken, ASN1ObjectIdentifier oid); static X509CertificateHolder getX509CertificateHolder(CertificateToken certToken); static CertificateToken getCertificate(final X509CertificateHolder x509CertificateHolder); static CertificateIdentifier toIssuerSerialInfo(SignerId signerId); static X500Principal toX500Principal(X500Name x500Name); static CertificateIdentifier toCertificateIdentifier(final X500Principal issuerX500Principal, final BigInteger serialNumber, final byte[] ski); static IssuerSerial getIssuerSerial(final CertificateToken certToken); static boolean x500PrincipalAreEquals(final X500Principal firstX500Principal, final X500Principal secondX500Principal); static Map<String, String> get(final X500Principal x500Principal); static X500Principal getNormalizedX500Principal(final X500Principal x500Principal); static String getUtf8String(final X500Principal x500Principal); static String getString(ASN1Encodable attributeValue); static String extractAttributeFromX500Principal(ASN1ObjectIdentifier identifier, X500PrincipalHelper principal); static String getSubjectCommonName(CertificateToken cert); static String getHumanReadableName(CertificateToken cert); static SignerInformation getFirstSignerInformation(final CMSSignedData cms); static boolean isASN1SequenceTag(byte tagByte); static Date getDate(ASN1Encodable encodable); static boolean isEmpty(AttributeTable attributeTable); static AttributeTable emptyIfNull(AttributeTable original); static List<String> getExtendedKeyUsage(CertificateToken certToken); static IssuerSerial getIssuerSerial(byte[] binaries); static CertificateIdentifier toCertificateIdentifier(IssuerSerial issuerAndSerial); static ASN1Sequence getAtsHashIndex(AttributeTable timestampUnsignedAttributes); static ASN1Sequence getAtsHashIndexByVersion(AttributeTable timestampUnsignedAttributes, 
			ASN1ObjectIdentifier atsHashIndexVersionIdentifier); static ASN1ObjectIdentifier getAtsHashIndexVersionIdentifier(AttributeTable timestampUnsignedAttributes); static List<byte[]> getOctetStringForAtsHashIndex(Attribute attribute, ASN1ObjectIdentifier atsHashIndexVersionIdentifier); static ASN1Encodable getAsn1Encodable(AttributeTable unsignedAttributes, ASN1ObjectIdentifier oid); static ASN1Set getAsn1AttributeSet(AttributeTable unsignedAttributes, ASN1ObjectIdentifier oid); static Attribute[] getAsn1Attributes(AttributeTable unsignedAttributes, ASN1ObjectIdentifier oid); static List<TimeStampToken> findArchiveTimeStampTokens(AttributeTable unsignedAttributes); static boolean isArchiveTimeStampToken(Attribute attribute); static boolean isAttributeOfType(Attribute attribute, ASN1ObjectIdentifier asn1ObjectIdentifier); static TimeStampToken getTimeStampToken(Attribute attribute); static CMSSignedData getCMSSignedData(Attribute attribute); static ASN1Encodable getAsn1Encodable(Attribute attribute); static Date getTimeStampTokenGenerationTime(TimeStampToken timeStampToken); static RevocationValues getRevocationValues(ASN1Encodable encodable); static CertificateRef getCertificateRef(OtherCertID otherCertId); static PSD2QcType getPSD2QcStatement(CertificateToken certToken); static List<String> getSubjectAlternativeNames(CertificateToken certToken); static SemanticsIdentifier getSemanticsIdentifier(CertificateToken certToken); }
DSSASN1Utils { public static List<String> getOCSPAccessLocations(final CertificateToken certificate) { return getAccessLocations(certificate, X509ObjectIdentifiers.id_ad_ocsp); } private  DSSASN1Utils(); @SuppressWarnings("unchecked") static T toASN1Primitive(final byte[] bytes); static byte[] getDEREncoded(ASN1Encodable asn1Encodable); static byte[] getBEREncoded(ASN1Encodable asn1Encodable); static byte[] getEncoded(BasicOCSPResp basicOCSPResp); static Date toDate(final ASN1GeneralizedTime asn1Date); static String toString(final ASN1OctetString value); static byte[] getEncoded(final TimeStampToken timeStampToken); static byte[] getEncoded(final CMSSignedData cmsSignedData); static byte[] getDEREncoded(final TimeStampToken timeStampToken); static byte[] getDEREncoded(final CMSSignedData data); static byte[] getDEREncoded(final TimestampBinary timestampBinary); static byte[] getDEREncoded(final byte[] bytes); static ASN1Sequence getAsn1SequenceFromDerOctetString(byte[] bytes); static byte[] getAsn1SignaturePolicyDigest(DigestAlgorithm digestAlgorithm, byte[] policyBytes); static AlgorithmIdentifier getAlgorithmIdentifier(final ASN1Sequence atsHashIndexValue); static AlgorithmIdentifier getAlgorithmIdentifier(DigestAlgorithm digestAlgorithm); static ASN1Sequence getCertificatesHashIndex(final ASN1Sequence atsHashIndexValue); static ASN1Sequence getCRLHashIndex(final ASN1Sequence atsHashIndexValue); static ASN1Sequence getUnsignedAttributesHashIndex(final ASN1Sequence atsHashIndexValue); @SuppressWarnings("unchecked") static List<DEROctetString> getDEROctetStrings(final ASN1Sequence asn1Sequence); static boolean hasIdPkixOcspNoCheckExtension(CertificateToken token); static List<CertificatePolicy> getCertificatePolicies(final CertificateToken certToken); static List<String> getQCStatementsIdList(final CertificateToken certToken); static List<String> getQCTypesIdList(final CertificateToken certToken); static List<String> getQCLegislations(CertificateToken certToken); static byte[] getSki(final CertificateToken certificateToken); static byte[] getSki(final CertificateToken certificateToken, boolean computeIfMissing); static byte[] getAuthorityKeyIdentifier(CertificateToken certificateToken); static byte[] computeSkiFromCert(final CertificateToken certificateToken); static byte[] computeSkiFromCertPublicKey(final PublicKey publicKey); static boolean isSkiEqual(final byte[] ski, final CertificateToken certificateToken); static List<String> getCAAccessLocations(final CertificateToken certificate); static List<String> getOCSPAccessLocations(final CertificateToken certificate); static List<String> getCrlUrls(final CertificateToken certificateToken); static boolean isOCSPSigning(CertificateToken certToken); static boolean isExtendedKeyUsagePresent(CertificateToken certToken, ASN1ObjectIdentifier oid); static X509CertificateHolder getX509CertificateHolder(CertificateToken certToken); static CertificateToken getCertificate(final X509CertificateHolder x509CertificateHolder); static CertificateIdentifier toIssuerSerialInfo(SignerId signerId); static X500Principal toX500Principal(X500Name x500Name); static CertificateIdentifier toCertificateIdentifier(final X500Principal issuerX500Principal, final BigInteger serialNumber, final byte[] ski); static IssuerSerial getIssuerSerial(final CertificateToken certToken); static boolean x500PrincipalAreEquals(final X500Principal firstX500Principal, final X500Principal secondX500Principal); static Map<String, String> get(final X500Principal x500Principal); static X500Principal getNormalizedX500Principal(final X500Principal x500Principal); static String getUtf8String(final X500Principal x500Principal); static String getString(ASN1Encodable attributeValue); static String extractAttributeFromX500Principal(ASN1ObjectIdentifier identifier, X500PrincipalHelper principal); static String getSubjectCommonName(CertificateToken cert); static String getHumanReadableName(CertificateToken cert); static SignerInformation getFirstSignerInformation(final CMSSignedData cms); static boolean isASN1SequenceTag(byte tagByte); static Date getDate(ASN1Encodable encodable); static boolean isEmpty(AttributeTable attributeTable); static AttributeTable emptyIfNull(AttributeTable original); static List<String> getExtendedKeyUsage(CertificateToken certToken); static IssuerSerial getIssuerSerial(byte[] binaries); static CertificateIdentifier toCertificateIdentifier(IssuerSerial issuerAndSerial); static ASN1Sequence getAtsHashIndex(AttributeTable timestampUnsignedAttributes); static ASN1Sequence getAtsHashIndexByVersion(AttributeTable timestampUnsignedAttributes, 
			ASN1ObjectIdentifier atsHashIndexVersionIdentifier); static ASN1ObjectIdentifier getAtsHashIndexVersionIdentifier(AttributeTable timestampUnsignedAttributes); static List<byte[]> getOctetStringForAtsHashIndex(Attribute attribute, ASN1ObjectIdentifier atsHashIndexVersionIdentifier); static ASN1Encodable getAsn1Encodable(AttributeTable unsignedAttributes, ASN1ObjectIdentifier oid); static ASN1Set getAsn1AttributeSet(AttributeTable unsignedAttributes, ASN1ObjectIdentifier oid); static Attribute[] getAsn1Attributes(AttributeTable unsignedAttributes, ASN1ObjectIdentifier oid); static List<TimeStampToken> findArchiveTimeStampTokens(AttributeTable unsignedAttributes); static boolean isArchiveTimeStampToken(Attribute attribute); static boolean isAttributeOfType(Attribute attribute, ASN1ObjectIdentifier asn1ObjectIdentifier); static TimeStampToken getTimeStampToken(Attribute attribute); static CMSSignedData getCMSSignedData(Attribute attribute); static ASN1Encodable getAsn1Encodable(Attribute attribute); static Date getTimeStampTokenGenerationTime(TimeStampToken timeStampToken); static RevocationValues getRevocationValues(ASN1Encodable encodable); static CertificateRef getCertificateRef(OtherCertID otherCertId); static PSD2QcType getPSD2QcStatement(CertificateToken certToken); static List<String> getSubjectAlternativeNames(CertificateToken certToken); static SemanticsIdentifier getSemanticsIdentifier(CertificateToken certToken);  }