public static Set<Integer> getIntegersFromAsn1Set(ASN1Encodable set) throws CertificateParsingException { if (!(set instanceof ASN1Set)) { throw new CertificateParsingException( "Expected set, found " + set.getClass().getName()); } ImmutableSet.Builder<Integer> builder = ImmutableSet.builder(); for (Enumeration<?> e = ((ASN1Set) set).getObjects(); e.hasMoreElements();) { builder.add(getIntegerFromAsn1((ASN1Integer) e.nextElement())); } return builder.build(); }
private Set<SignerInfo> getSignerSet(SignedData signedData) { final Set<SignerInfo> set = new HashSet<SignerInfo>(); final Enumeration<?> signerInfos = signedData.getSignerInfos().getObjects(); while (signerInfos.hasMoreElements()) { set.add(SignerInfo.getInstance(signerInfos.nextElement())); } return set; }
static Set<ASN1Primitive> asPrimitiveSet(ASN1Encodable encodable) { Enumeration enumeration = as(ASN1Set.class, encodable).getObjects(); Set<ASN1Primitive> set = new HashSet<>(); while (enumeration.hasMoreElements()) { ASN1Encodable element = (ASN1Encodable) enumeration.nextElement(); set.add(asPrimitive(element)); } return set; }
public int hashCode() { Enumeration e = this.getObjects(); int hashCode = size(); while (e.hasMoreElements()) { Object o = getNext(e); hashCode *= 17; hashCode ^= o.hashCode(); } return hashCode; }
public int hashCode() { Enumeration e = this.getObjects(); int hashCode = size(); while (e.hasMoreElements()) { Object o = getNext(e); hashCode *= 17; hashCode ^= o.hashCode(); } return hashCode; }
private boolean checkForVersion3(ASN1Set signerInfs) { for (Enumeration e = signerInfs.getObjects(); e.hasMoreElements();) { SignerInfo s = SignerInfo.getInstance(e.nextElement()); if (s.getVersion().getValue().intValue() == 3) { return true; } } return false; }
private boolean checkForVersion3(ASN1Set signerInfs) { for (Enumeration e = signerInfs.getObjects(); e.hasMoreElements();) { SignerInfo s = SignerInfo.getInstance(e.nextElement()); if (s.getVersion().getValue().intValue() == 3) { return true; } } return false; }
private String dumpSetOrSequence(ASN1Encodable asn1ConstructedType) throws Asn1Exception, IOException { StringBuilder sb = new StringBuilder(); sb.append(indentSequence.toString(indentLevel)); Enumeration<?> components; // Sequence or Set? if (asn1ConstructedType instanceof ASN1Sequence) { sb.append("SEQUENCE"); ASN1Sequence sequence = (ASN1Sequence) asn1ConstructedType; components = sequence.getObjects(); } else { // == SET sb.append("SET"); ASN1Set set = (ASN1Set) asn1ConstructedType; components = set.getObjects(); } sb.append(NEWLINE); sb.append(indentSequence.toString(indentLevel)); sb.append("{"); sb.append(NEWLINE); while (components.hasMoreElements()) { ASN1Primitive component = (ASN1Primitive) components.nextElement(); sb.append(dump(component)); } sb.append(indentSequence.toString(indentLevel)); sb.append("}"); sb.append(NEWLINE); return sb.toString(); }
public static int calculateVersion(OriginatorInfo originatorInfo, ASN1Set recipientInfos, ASN1Set unprotectedAttrs) { int version; if (originatorInfo != null || unprotectedAttrs != null) { version = 2; } else { version = 0; Enumeration e = recipientInfos.getObjects(); while (e.hasMoreElements()) { RecipientInfo ri = RecipientInfo.getInstance(e.nextElement()); if (ri.getVersion().getValue().intValue() != version) { version = 2; break; } } } return version; } }
public static int calculateVersion(OriginatorInfo originatorInfo, ASN1Set recipientInfos, ASN1Set unprotectedAttrs) { int version; if (originatorInfo != null || unprotectedAttrs != null) { version = 2; } else { version = 0; Enumeration e = recipientInfos.getObjects(); while (e.hasMoreElements()) { RecipientInfo ri = RecipientInfo.getInstance(e.nextElement()); if (ri.getVersion().getValue().intValue() != version) { version = 2; break; } } } return version; } }
final Enumeration<?> certEnum = certs.getObjects(); while (certEnum.hasMoreElements()) { ASN1Sequence o = (ASN1Sequence) certEnum.nextElement(); final Enumeration<?> crlEnum = crls.getObjects(); while (crlEnum.hasMoreElements()) { ASN1Sequence o = (ASN1Sequence) crlEnum.nextElement();
private static void validateAttributes(ASN1Set attributes) { if (attributes == null) { return; } for (Enumeration en = attributes.getObjects(); en.hasMoreElements();) { Attribute attr = Attribute.getInstance(en.nextElement()); if (attr.getAttrType().equals(PKCSObjectIdentifiers.pkcs_9_at_challengePassword)) { if (attr.getAttrValues().size() != 1) { throw new IllegalArgumentException("challengePassword attribute must have one value"); } } } } }
for (Enumeration e = origInfo.getCertificates().getObjects(); e.hasMoreElements();) for (Enumeration e = origInfo.getCRLs().getObjects(); e.hasMoreElements();)
for (Enumeration e = origInfo.getCertificates().getObjects(); e.hasMoreElements();) for (Enumeration e = origInfo.getCRLs().getObjects(); e.hasMoreElements();)
boolean asn1Equals( ASN1Primitive o) { if (!(o instanceof ASN1Set)) { return false; } ASN1Set other = (ASN1Set)o; if (this.size() != other.size()) { return false; } Enumeration s1 = this.getObjects(); Enumeration s2 = other.getObjects(); while (s1.hasMoreElements()) { ASN1Encodable obj1 = getNext(s1); ASN1Encodable obj2 = getNext(s2); ASN1Primitive o1 = obj1.toASN1Primitive(); ASN1Primitive o2 = obj2.toASN1Primitive(); if (o1 == o2 || o1.equals(o2)) { continue; } return false; } return true; }
boolean asn1Equals( ASN1Primitive o) { if (!(o instanceof ASN1Set)) { return false; } ASN1Set other = (ASN1Set)o; if (this.size() != other.size()) { return false; } Enumeration s1 = this.getObjects(); Enumeration s2 = other.getObjects(); while (s1.hasMoreElements()) { ASN1Encodable obj1 = getNext(s1); ASN1Encodable obj2 = getNext(s2); ASN1Primitive o1 = obj1.toASN1Primitive(); ASN1Primitive o2 = obj2.toASN1Primitive(); if (o1 == o2 || o1.equals(o2)) { continue; } return false; } return true; }
final ASN1Set signedDataCRLs = signedData.getCRLs(); if (signedDataCRLs != null) { final Enumeration<ASN1Encodable> crLs = signedDataCRLs.getObjects(); if (crLs != null) { while (crLs.hasMoreElements()) {
e = ((ASN1Set)obj).getObjects();
/** * The field crlsHashIndex is a sequence of octet strings. Each one contains the hash value of one instance of * RevocationInfoChoice within crls field of the root SignedData. A hash value for every instance of * RevocationInfoChoice, as present at the time when the corresponding archive time-stamp is requested, shall be * included in crlsHashIndex. No other hash values shall be included in this field. * * @return * @throws eu.europa.ec.markt.dss.exception.DSSException */ @SuppressWarnings("unchecked") private ASN1Sequence getCRLsHashIndex() throws DSSException { final ASN1EncodableVector crlsHashIndex = new ASN1EncodableVector(); final SignedData signedData = SignedData.getInstance(cadesSignature.getCmsSignedData().toASN1Structure().getContent()); final ASN1Set signedDataCRLs = signedData.getCRLs(); if (signedDataCRLs != null) { final Enumeration<ASN1Encodable> crLs = signedDataCRLs.getObjects(); if (crLs != null) { while (crLs.hasMoreElements()) { final ASN1Encodable asn1Encodable = crLs.nextElement(); digestAndAddToList(crlsHashIndex, DSSASN1Utils.getDEREncoded(asn1Encodable)); } } } return new DERSequence(crlsHashIndex); }
e = ((ASN1Set)obj).getObjects();