List of usage examples for org.bouncycastle.asn1.esf CommitmentTypeIndication getInstance
public static CommitmentTypeIndication getInstance(Object obj)
From source file:eu.europa.ec.markt.dss.validation102853.cades.CAdESSignature.java
License:Open Source License
@Override public CommitmentType getCommitmentTypeIndication() { final AttributeTable attributes = signerInformation.getSignedAttributes(); if (attributes == null) { return null; }/*w w w. jav a 2 s .c o m*/ final Attribute commitmentTypeIndicationAttribute = attributes .get(PKCSObjectIdentifiers.id_aa_ets_commitmentType); if (commitmentTypeIndicationAttribute != null) { try { final ASN1Set attrValues = commitmentTypeIndicationAttribute.getAttrValues(); final int size = attrValues.size(); if (size > 0) { final CommitmentType commitmentType = new CommitmentType(); for (int ii = 0; ii < size; ii++) { final DERSequence derSequence = (DERSequence) attrValues.getObjectAt(ii); final CommitmentTypeIndication commitmentTypeIndication = CommitmentTypeIndication .getInstance(derSequence); final ASN1ObjectIdentifier commitmentTypeId = commitmentTypeIndication .getCommitmentTypeId(); commitmentType.addIdentifier(commitmentTypeId.getId()); } return commitmentType; } } catch (Exception e) { throw new DSSException("Error when dealing with CommitmentTypeIndication!", e); } } return null; }
From source file:eu.europa.esig.dss.cades.validation.CAdESSignature.java
License:Open Source License
@Override public CommitmentType getCommitmentTypeIndication() { final AttributeTable attributes = signerInformation.getSignedAttributes(); if (attributes == null) { return null; }/*from w ww . java 2 s.c om*/ final Attribute commitmentTypeIndicationAttribute = attributes .get(PKCSObjectIdentifiers.id_aa_ets_commitmentType); if (commitmentTypeIndicationAttribute != null) { try { final ASN1Set attrValues = commitmentTypeIndicationAttribute.getAttrValues(); final int size = attrValues.size(); if (size > 0) { final CommitmentType commitmentType = new CommitmentType(); for (int ii = 0; ii < size; ii++) { if (attrValues.getObjectAt(ii) instanceof DERSequence) { final DERSequence derSequence = (DERSequence) attrValues.getObjectAt(ii); final CommitmentTypeIndication commitmentTypeIndication = CommitmentTypeIndication .getInstance(derSequence); final ASN1ObjectIdentifier commitmentTypeId = commitmentTypeIndication .getCommitmentTypeId(); commitmentType.addIdentifier(commitmentTypeId.getId()); } else { LOG.warn("Unsupported type for CommitmentType : " + attrValues.getObjectAt(ii).getClass()); } } return commitmentType; } } catch (Exception e) { throw new DSSException("Error when dealing with CommitmentTypeIndication!", e); } } return null; }