org.bouncycastle.asn1.cms.AttributeTable Java Examples
The following examples show how to use
org.bouncycastle.asn1.cms.AttributeTable.
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: CMSSignedDataBuilder.java From dss with GNU Lesser General Public License v2.1 | 6 votes |
/** * This method creates a builder of SignerInfoGenerator * * @param digestCalculatorProvider * the digest calculator (can be pre-computed) * @param signedAttributes * the signedAttributes * @param unsignedAttributes * the unsignedAttributes * @return a SignerInfoGeneratorBuilder that generate the signed and unsigned attributes according to the parameters */ private SignerInfoGeneratorBuilder getSignerInfoGeneratorBuilder(DigestCalculatorProvider digestCalculatorProvider, AttributeTable signedAttributes, AttributeTable unsignedAttributes) { if (DSSASN1Utils.isEmpty(signedAttributes)) { signedAttributes = null; } final DefaultSignedAttributeTableGenerator signedAttributeGenerator = new DefaultSignedAttributeTableGenerator(signedAttributes); if (DSSASN1Utils.isEmpty(unsignedAttributes)) { unsignedAttributes = null; } final SimpleAttributeTableGenerator unsignedAttributeGenerator = new SimpleAttributeTableGenerator(unsignedAttributes); SignerInfoGeneratorBuilder sigInfoGeneratorBuilder = new SignerInfoGeneratorBuilder(digestCalculatorProvider); sigInfoGeneratorBuilder.setSignedAttributeGenerator(signedAttributeGenerator); sigInfoGeneratorBuilder.setUnsignedAttributeGenerator(unsignedAttributeGenerator); return sigInfoGeneratorBuilder; }
Example #2
Source File: PAdESOCSPSource.java From dss with GNU Lesser General Public License v2.1 | 6 votes |
private void collectOCSPArchivalValues(AttributeTable attributes) { final ASN1Encodable attValue = DSSASN1Utils.getAsn1Encodable(attributes, OID.adbe_revocationInfoArchival); if (attValue !=null) { RevocationInfoArchival revocationArchival = PAdESUtils.getRevocationInfoArchivals(attValue); if (revocationArchival != null) { for (final OCSPResponse ocspResponse : revocationArchival.getOcspVals()) { final OCSPResp ocspResp = new OCSPResp(ocspResponse); try { BasicOCSPResp basicOCSPResponse = (BasicOCSPResp) ocspResp.getResponseObject(); addBinary(OCSPResponseBinary.build(basicOCSPResponse), RevocationOrigin.ADBE_REVOCATION_INFO_ARCHIVAL); } catch (OCSPException e) { LOG.warn("Error while extracting OCSPResponse from Revocation Info Archivals (ADBE) : {}", e.getMessage()); } } } } }
Example #3
Source File: CMSCertificateSource.java From dss with GNU Lesser General Public License v2.1 | 6 votes |
private void extractCertificateRefsFromUnsignedAttribute(ASN1ObjectIdentifier attributeOid, CertificateRefOrigin origin) { AttributeTable unsignedAttributes = currentSignerInformation.getUnsignedAttributes(); if (unsignedAttributes != null) { Attribute attribute = unsignedAttributes.get(attributeOid); if (attribute != null) { final ASN1Sequence seq = (ASN1Sequence) attribute.getAttrValues().getObjectAt(0); for (int ii = 0; ii < seq.size(); ii++) { try { OtherCertID otherCertId = OtherCertID.getInstance(seq.getObjectAt(ii)); CertificateRef certRef = DSSASN1Utils.getCertificateRef(otherCertId); certRef.setOrigin(origin); addCertificateRef(certRef, origin); } catch (Exception e) { LOG.warn("Unable to parse encapsulated OtherCertID : {}", e.getMessage()); } } } } }
Example #4
Source File: CMSCertificateSource.java From dss with GNU Lesser General Public License v2.1 | 6 votes |
private void extractCertificateValues() { AttributeTable unsignedAttributes = currentSignerInformation.getUnsignedAttributes(); if (unsignedAttributes != null) { Attribute attribute = unsignedAttributes.get(id_aa_ets_certValues); if (attribute != null) { final ASN1Sequence seq = (ASN1Sequence) attribute.getAttrValues().getObjectAt(0); for (int ii = 0; ii < seq.size(); ii++) { try { final Certificate cs = Certificate.getInstance(seq.getObjectAt(ii)); addCertificate(DSSUtils.loadCertificate(cs.getEncoded()), CertificateOrigin.CERTIFICATE_VALUES); } catch (Exception e) { LOG.warn("Unable to parse encapsulated certificate : {}", e.getMessage()); } } } } }
Example #5
Source File: JarSigner.java From keystore-explorer with GNU General Public License v3.0 | 6 votes |
private static CMSSignedData addTimestamp(String tsaUrl, CMSSignedData signedData) throws IOException { Collection<SignerInformation> signerInfos = signedData.getSignerInfos().getSigners(); // get signature of first signer (should be the only one) SignerInformation si = signerInfos.iterator().next(); byte[] signature = si.getSignature(); // send request to TSA byte[] token = TimeStampingClient.getTimeStampToken(tsaUrl, signature, DigestType.SHA1); // create new SignerInformation with TS attribute Attribute tokenAttr = new Attribute(PKCSObjectIdentifiers.id_aa_signatureTimeStampToken, new DERSet(ASN1Primitive.fromByteArray(token))); ASN1EncodableVector timestampVector = new ASN1EncodableVector(); timestampVector.add(tokenAttr); AttributeTable at = new AttributeTable(timestampVector); si = SignerInformation.replaceUnsignedAttributes(si, at); signerInfos.clear(); signerInfos.add(si); SignerInformationStore newSignerStore = new SignerInformationStore(signerInfos); // create new signed data CMSSignedData newSignedData = CMSSignedData.replaceSigners(signedData, newSignerStore); return newSignedData; }
Example #6
Source File: CMSOCSPSource.java From dss with GNU Lesser General Public License v2.1 | 6 votes |
private void collectRevocationRefs(AttributeTable unsignedAttributes, ASN1ObjectIdentifier revocationReferencesAttribute, RevocationRefOrigin origin) { final Attribute attribute = unsignedAttributes.get(revocationReferencesAttribute); if (attribute == null) { return; } final ASN1Set attrValues = attribute.getAttrValues(); if (attrValues.size() <= 0) { return; } final ASN1Encodable attrValue = attrValues.getObjectAt(0); final ASN1Sequence completeRevocationRefs = (ASN1Sequence) attrValue; for (int i = 0; i < completeRevocationRefs.size(); i++) { final CrlOcspRef otherCertId = CrlOcspRef.getInstance(completeRevocationRefs.getObjectAt(i)); final OcspListID ocspListID = otherCertId.getOcspids(); if (ocspListID != null) { for (final OcspResponsesID ocspResponsesID : ocspListID.getOcspResponses()) { final OCSPRef ocspRef = new OCSPRef(ocspResponsesID); addRevocationReference(ocspRef, origin); } } } }
Example #7
Source File: CMSOCSPSource.java From dss with GNU Lesser General Public License v2.1 | 6 votes |
private void collectRevocationValues(AttributeTable attributes, ASN1ObjectIdentifier revocationValueAttributes, RevocationOrigin origin) { final ASN1Encodable attValue = DSSASN1Utils.getAsn1Encodable(attributes, revocationValueAttributes); if (attValue !=null) { RevocationValues revocationValues = DSSASN1Utils.getRevocationValues(attValue); if (revocationValues != null) { for (final BasicOCSPResponse basicOCSPResponse : revocationValues.getOcspVals()) { final BasicOCSPResp basicOCSPResp = new BasicOCSPResp(basicOCSPResponse); OCSPResponseBinary ocspResponseIdentifier = OCSPResponseBinary.build(basicOCSPResp); addBinary(ocspResponseIdentifier, origin); } } /* * TODO: should add also OtherRevVals, but: "The syntax and semantics of the * other revocation values (OtherRevVals) are outside the scope of the present * document. The definition of the syntax of the other form of revocation * information is as identified by OtherRevRefType." */ } }
Example #8
Source File: CadesLevelBaselineLTATimestampExtractor.java From dss with GNU Lesser General Public License v2.1 | 6 votes |
/** * get the atsHash index for verification of the provided token. * * @param signerInformation * @param timestampToken * @return a re-built ats-hash-index */ public Attribute getVerifiedAtsHashIndex(SignerInformation signerInformation, TimestampToken timestampToken) { final AttributeTable unsignedAttributes = timestampToken.getUnsignedAttributes(); ASN1ObjectIdentifier atsHashIndexVersionIdentifier = DSSASN1Utils.getAtsHashIndexVersionIdentifier(unsignedAttributes); ASN1Sequence atsHashIndex = DSSASN1Utils.getAtsHashIndexByVersion(unsignedAttributes, atsHashIndexVersionIdentifier); if (atsHashIndex == null) { LOG.warn("A valid atsHashIndex [oid: {}] has not been found for a timestamp with id {}", atsHashIndexVersionIdentifier, timestampToken.getDSSIdAsString()); } final AlgorithmIdentifier derObjectAlgorithmIdentifier = getAlgorithmIdentifier(atsHashIndex); final ASN1Sequence certificatesHashIndex = getVerifiedCertificatesHashIndex(atsHashIndex); final ASN1Sequence crLsHashIndex = getVerifiedCRLsHashIndex(atsHashIndex); final ASN1Sequence verifiedAttributesHashIndex = getVerifiedUnsignedAttributesHashIndex(signerInformation, atsHashIndex, atsHashIndexVersionIdentifier); return getComposedAtsHashIndex(derObjectAlgorithmIdentifier, certificatesHashIndex, crLsHashIndex, verifiedAttributesHashIndex, atsHashIndexVersionIdentifier); }
Example #9
Source File: CadesLevelBaselineLTATimestampExtractor.java From dss with GNU Lesser General Public License v2.1 | 6 votes |
/** * The field unsignedAttrsHashIndex is a sequence of octet strings. Each one contains the hash value of one * instance of Attribute within unsignedAttrs field of the SignerInfo. A hash value for every instance of * Attribute, as present at the time when the corresponding archive time-stamp is requested, shall be included in * unsignedAttrsHashIndex. No other hash values shall be included in this field. * * @param signerInformation {@link SignerInformation} * @param atsHashIndexVersionIdentifier {@link ASN1ObjectIdentifier} of the ats-hash-index table version to create * @return */ private ASN1Sequence getUnsignedAttributesHashIndex(SignerInformation signerInformation, ASN1ObjectIdentifier atsHashIndexVersionIdentifier) { final ASN1EncodableVector unsignedAttributesHashIndex = new ASN1EncodableVector(); AttributeTable unsignedAttributes = signerInformation.getUnsignedAttributes(); final ASN1EncodableVector asn1EncodableVector = unsignedAttributes.toASN1EncodableVector(); for (int i = 0; i < asn1EncodableVector.size(); i++) { final Attribute attribute = (Attribute) asn1EncodableVector.get(i); if (!excludedAttributesFromAtsHashIndex.contains(attribute.getAttrType())) { List<DEROctetString> attributeDerOctetStringHashes = getAttributeDerOctetStringHashes(attribute, atsHashIndexVersionIdentifier); for (DEROctetString derOctetStringDigest : attributeDerOctetStringHashes) { unsignedAttributesHashIndex.add(derOctetStringDigest); } } } return new DERSequence(unsignedAttributesHashIndex); }
Example #10
Source File: CAdESLevelBaselineB.java From dss with GNU Lesser General Public License v2.1 | 6 votes |
public AttributeTable getSignedAttributes(final CAdESSignatureParameters parameters) { if (Utils.isArrayNotEmpty(parameters.getSignedData())) { LOG.debug("Using explict SignedAttributes from parameter"); return CMSUtils.getAttributesFromByteArray(parameters.getSignedData()); } ASN1EncodableVector signedAttributes = new ASN1EncodableVector(); addSigningCertificateAttribute(parameters, signedAttributes); addSigningTimeAttribute(parameters, signedAttributes); addSignerAttribute(parameters, signedAttributes); addSignaturePolicyId(parameters, signedAttributes); addContentHints(parameters, signedAttributes); addContentIdentifier(parameters, signedAttributes); addCommitmentType(parameters, signedAttributes); addSignerLocation(parameters, signedAttributes); addContentTimestamps(parameters, signedAttributes); // mime-type attribute breaks parallel signatures by adding PKCS7 as a mime-type for subsequent signers. // This attribute is not mandatory, so it has been disabled. return new AttributeTable(signedAttributes); }
Example #11
Source File: CAdESTimeStampSigner.java From signer with GNU Lesser General Public License v3.0 | 5 votes |
@Override public List<Timestamp> checkTimeStampOnSignature(byte[] signature) { try { Security.addProvider(new BouncyCastleProvider()); List<Timestamp> listOfTimeStamp = new ArrayList<Timestamp>(); CMSSignedData cmsSignedData = new CMSSignedData(signature); SignerInformationStore signers = cmsSignedData.getSignerInfos(); Iterator<?> it = signers.getSigners().iterator(); while (it.hasNext()) { SignerInformation signer = (SignerInformation) it.next(); AttributeTable unsignedAttributes = signer .getUnsignedAttributes(); Attribute attributeTimeStamp = unsignedAttributes .get(new ASN1ObjectIdentifier( PKCSObjectIdentifiers.id_aa_signatureTimeStampToken .getId())); if (attributeTimeStamp != null) { TimeStampOperator timeStampOperator = new TimeStampOperator(); byte[] varTimeStamp = attributeTimeStamp.getAttrValues() .getObjectAt(0).toASN1Primitive().getEncoded(); TimeStampToken timeStampToken = new TimeStampToken( new CMSSignedData(varTimeStamp)); Timestamp timeStampSigner = new Timestamp(timeStampToken); timeStampOperator.validate(signer.getSignature(), varTimeStamp, null); listOfTimeStamp.add(timeStampSigner); } } return listOfTimeStamp; } catch (CertificateCoreException | IOException | TSPException | CMSException e) { throw new SignerException(e); } }
Example #12
Source File: DecodedPkiMessage.java From xipki with Apache License 2.0 | 5 votes |
private static String getPrintableStringAttrValue(AttributeTable attrs, ASN1ObjectIdentifier type) throws MessageDecodingException { ASN1Encodable value = ScepUtil.getFirstAttrValue(attrs, type); if (value instanceof DERPrintableString) { return ((DERPrintableString) value).getString(); } else if (value != null) { throw new MessageDecodingException("the value of attribute " + type.getId() + " is not PrintableString"); } else { return null; } }
Example #13
Source File: DSSASN1UtilsTest.java From dss with GNU Lesser General Public License v2.1 | 5 votes |
@Test public void isEmpty() { assertTrue(DSSASN1Utils.isEmpty(null)); assertTrue(DSSASN1Utils.isEmpty(new AttributeTable(new Hashtable<>()))); Hashtable<ASN1ObjectIdentifier, Object> nonEmpty = new Hashtable<>(); nonEmpty.put(new ASN1ObjectIdentifier("1.2.3.4.5"), 4); assertFalse(DSSASN1Utils.isEmpty(new AttributeTable(nonEmpty))); }
Example #14
Source File: CMSSignedDataBuilder.java From dss with GNU Lesser General Public License v2.1 | 5 votes |
/** * This method creates a builder of SignerInfoGenerator * * @param digestCalculatorProvider * the digest calculator (can be pre-computed) * @param parameters * the parameters of the signature containing values for the attributes * @param includeUnsignedAttributes * true if the unsigned attributes must be included * @return a SignerInfoGeneratorBuilder that generate the signed and unsigned attributes according to the * CAdESLevelBaselineB */ SignerInfoGeneratorBuilder getSignerInfoGeneratorBuilder(DigestCalculatorProvider digestCalculatorProvider, final CAdESSignatureParameters parameters, final boolean includeUnsignedAttributes) { final CAdESLevelBaselineB cadesProfile = new CAdESLevelBaselineB(); final AttributeTable signedAttributes = cadesProfile.getSignedAttributes(parameters); AttributeTable unsignedAttributes = null; if (includeUnsignedAttributes) { unsignedAttributes = cadesProfile.getUnsignedAttributes(); } return getSignerInfoGeneratorBuilder(digestCalculatorProvider, signedAttributes, unsignedAttributes); }
Example #15
Source File: DSSASN1UtilsTest.java From dss with GNU Lesser General Public License v2.1 | 5 votes |
@Test public void findArchiveTimeStampTokensTest() { ASN1EncodableVector asn1EncodableVector = new ASN1EncodableVector(); String atstV2 = "MIIIcgYJKoZIhvcNAQcCoIIIYzCCCF8CAQMxDzANBglghkgBZQMEAgEFADCCARMGCyqGSIb3DQEJEAEEoIIBAgSB/zCB/AIBAQYKKwYBBAH7SwUCAjAxMA0GCWCGSAFlAwQCAQUABCAm67S7cA/ArzsncKnDKJk7AQVkbbH2LmjhxjNFGKEKeAIVAKQr5q6pobk+BGS1xZJBa0LrWjgtGBMyMDE4MDUwNzE0MTMxNy41OTNaMAOAAQECCQDdRKjMw1Tj/aB8pHoweDEpMCcGA1UEAxMgVW5pdmVyc2lnbiBUaW1lc3RhbXBpbmcgVW5pdCAwMjExHDAaBgNVBAsTE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iBUaW1lc3RhbXBpbmcgQ0EgMjAxNQIQWh/wl2n+6D045tXkVdEH/zANBgkqhkiG9w0BAQsFAASCAQA4NsVVHBUrIs+zoonsl2eFUVwBehoTZJJvLSp41Q3jdAci2ppTzL/8rsvlv3RwDc6lMcOFDZhSuKOIT8rLXPg050xAglxUzkN0r9WpscQ6/cfJZmvVTf01gERTYuqrLhs5lF2qdEOty+42VeJB4hW/gAunEQxJuOyO1xGRBkgyIQq2t63FcwR/+Qw9IWRByNp15Bdt30HpvmyvhR3y/T4hK/9NatRAxoBIRhHXlwUT15Bphf22bDuOyEJyOYnviAvpcUq0g5v7KQcIJdmk93elzo+n8yIwCS7lm3XhZYLsyocLbQBP6oNCZlrNZ4YL4SuMcP0JWW7jfj/+OzWGax8H"; ASN1Primitive asn1Primitive = DSSASN1Utils.toASN1Primitive(Utils.fromBase64(atstV2)); Attribute atstV2Attibute = new Attribute(OID.id_aa_ets_archiveTimestampV2, new DERSet(asn1Primitive)); asn1EncodableVector.add(atstV2Attibute); String malformedAtstV2 = "MIIIhwYLKoZIhvcNAQkQAjAxggh2MIIIcgYJKoZIhvcNAQcCoIIIYzCCCF8CAQMxDzANBglghkgBZQMEAgEFADCCARMGCyqGSIb3DQEJEAEEoIIBAgSB/zCB/AIBAQYKKwYBBAH7SwUCAjAxMA0GCWCGSAFlAwQCAQUABCAm67S7cA/ArzsncKnDKJk7AQVkbbH2LmjhxjNFGKEKeAIVAKQr5q6pobk+BGS1xZJBa0LrWjgtGBMyMDE4MDUwNzE0MTMxNy41OTNaMAOAAQECCQDdRKjMw1Tj/aB8pHoweDEpMCcGA1UEAxMgVW5pdmVyc2lnbiBUaW1lc3RhbXBpbmcgVW5pdCAwMjExHDAaBgNVBAsTEzAwMDIgNDM5MTI5MTY0MDAwMjYxIDAeBgNVBAoTF0NyeXB0b2xvZyBJbnRlcm5hdGlvbmFsMQswCQYDVQQGEwJGUqCCBGAwggRcMIIDRKADAgECAhBaH/CXaf7oPTjm1eRV0Qf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RwDc6lMcOFDZhSuKOIT8rLXPg050xAglxUzkN0r9WpscQ6/cfJZmvVTf01gERTYuqrLhs5lF2qdEOty+42VeJB4hW/gAunEQxJuOyO1xGRBkgyIQq2t63FcwR/+Qw9IWRByNp15Bdt30HpvmyvhR3y/T4hK/9NatRAxoBIRhHXlwUT15Bphf22bDuOyEJyOYnviAvpcUq0g5v7KQcIJdmk93elzo+n8yIwCS7lm3XhZYLsyocLbQBP6oNCZlrNZ4YL4SuMcP0JWW7jfj/+OzWGax8H"; asn1Primitive = DSSASN1Utils.toASN1Primitive(Utils.fromBase64(malformedAtstV2)); Attribute malformedAtstV2Attibute = new Attribute(OID.id_aa_ets_archiveTimestampV2, new DERSet(asn1Primitive)); asn1EncodableVector.add(malformedAtstV2Attibute); String atstV3 = "MIIJWwYJKoZIhvcNAQcCoIIJTDCCCUgCAQMxDzANBglghkgBZQMEAgMFADCB/gYLKoZIhvcNAQkQAQSgge4EgeswgegCAQEGBgQAj2cBATAxMA0GCWCGSAFlAwQCAQUABCCn0cRUUvQwpjtFZ8VAx0nzxzu3gZ2Ymqcp87qgiY/4OQIIXuTHubzkaM4YDzIwMjAwNDExMTIzNDQwWjADAgEBAgiO+SBfQ41ZO6B+pHwwejEnMCUGA1UEAwweU0sgVElNRVNUQU1QSU5HIEFVVEhPUklUWSAyMDIwMRcwFQYDVQRhDA5OVFJFRS0xMDc0NzAxMzEMMAoGA1UECwwDVFNBMRswGQYDVQQKDBJTSyBJRCBTb2x1dGlvbnMgQVMxCzAJBgNVBAYTAkVFoIIEGjCCBBYwggL+oAMCAQICEGI2fXRa2UOrXaRQuV4/+m4wDQYJKoZIhvcNAQELBQAwdTELMAkGA1UEBhMCRUUxIjAgBgNVBAoMGUFTIFNlcnRpZml0c2VlcmltaXNrZXNrdXMxKDAmBgNVBAMMH0VFIENlcnRpZmljYXRpb24gQ2VudHJlIFJvb3QgQ0ExGDAWBgkqhkiG9w0BCQEWCXBraUBzay5lZTAeFw0xOTEyMzEyMjA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nKAQThjWtw4qGtswyqeCKh+EMCe62B5ZC+1bZTlohfD1GhggEHMIIBAwYGBACNRQIFMYH4MIH1MGYEIK3f+m/QgJpUqfCzH9JfdL9/LXrhHID9mdqg+2A6Zc0OBCCkXt47u/CciuFccu/AcmjWk6IcmW/VHmfKB5Rg/W2IcwQgYMHF0qMQHKR1OJ2F1UQbg+HTVL+OJeft+dR5H4CzDtowADCBiAQgvqmBrWZOoI5LCE6ZgL6B1pSwGikyP/Gpw87i+EyQp0cEIHmnEgy9yobW4GAfAad4eiVXn6pdMKNizXvUwzqd/eyKBCBu1yd6G1zNfHMHbTc/VvEe5Q85N/6gpJekpgWhLuBQxQQg3WcimJCwZgUxiFzPw7zMX8F4+FTiNC/lXpKaOmvbSQE="; asn1Primitive = DSSASN1Utils.toASN1Primitive(Utils.fromBase64(atstV3)); Attribute atstV3Attibute = new Attribute(OID.id_aa_ets_archiveTimestampV3, new DERSet(asn1Primitive)); asn1EncodableVector.add(atstV3Attibute); String sigTst = "MIIVJQYJKoZIhvcNAQcCoIIVFjCCFRICAQMxDzANBglghkgBZQMEAgEFADCCARMGCyqGSIb3DQEJEAEEoIIBAgSB/zCB/AIBAQYKKwYBBAH7SwUCAjAxMA0GCWCGSAFlAwQCAQUABCBT2S93XuvGV5XB9P74rlXpEBNQw7v+LkhVqlWcwyGgDwIVAKzJneGO+8crMY8T0qaCcD2284U4GBMyMDE4MDUwNzE0MTMxMS4xMDRaMAOAAQECCQDAIEqncxQduqB8pHoweDEpMCcGA1UEAxMgVW5pdmVyc2lnbiBUaW1lc3RhbXBpbmcgVW5pdCAwMjAxHDAaBgNVBAsTEzAwMDIgNDM5MTI5MTY0MDAwMjYxIDAeBgNVBAoTF0NyeXB0b2xvZyBJbnRlcm5hdGlvbmFsMQswCQYDVQQGEwJGUqCCBGEwggRdMIIDRaADAgECAhEArBfUtF0gHC6S0qdGjvl/XDANBgkqhkiG9w0BAQsFADB3MQswCQYDVQQGEwJGUjEgMB4GA1UEChMXQ3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32C3Clv2k5S31797WcXz6EmkkaNFHcEAetsChyitR7dq6wyzYPxlyRVIBm8lR3fCaIaYcUoGoXaimcIysOgc+RrqvgcXiZ7Hi2yNmtpg0DVzVnYAS5EjSJcGsjcTlFtcNqEl7L1FqP0DqsGwW/sjef1BRzTDB0IMrItiAkV3zvVXE67UwC8l8DtJaveb+KBCvhL2wcBijfilXzIdwBBg7w/rtLaTDFUFqn4WvWk4buoQESbb7WK0KNM9McSPF8OlyNggkgySgoouX70t9POZEGMZyZ0="; asn1Primitive = DSSASN1Utils.toASN1Primitive(Utils.fromBase64(sigTst)); Attribute sigTstsAttibute = new Attribute(PKCSObjectIdentifiers.id_aa_signatureTimeStampToken, new DERSet(asn1Primitive)); asn1EncodableVector.add(sigTstsAttibute); String certValues = "MIIL6wYLKoZIhvcNAQkQAhcxggvaMIIL1jCCBZ8wggSHoAMCAQICFDdbittYXdJlQ+xDC4cAUwx+EP2eMA0GCSqGSIb3DQEBCwUAMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYDVQQDEyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTE0MDUzMDE4MTU0OVoXDTIxMDMxNzE4MzMzM1owaDELMAkGA1UEBhMCTkwxIDAeBgNVBAoTF1F1b1ZhZGlzIFRydXN0bGluayBCLlYuMTcwNQYDVQQDEy5RdW9WYWRpcyBFVSBJc3N1aW5nIENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEczMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAlBRBbnMy0pZB34/kk8jnEovgphznCp1JvoZ1DDG/OaCusN1fgkglNJp/Evw+h59cobd/md2BBc3d95yvERP9LEgWYIFxzkm4eqU7TARr926V06gX8T5+4EAusMApvT4rbcbQYaEpcC1HgKmEJd96N3WHtXZdYmkW7y4bd1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7ezMJkLZp1u/A6WYAsuPU2YbZ7iFofX1ApvGJyDWVv3nVjipjQ/xgcdcKvPwHhaQd4kJ8+LYsiFPehm/7xXSG3dUWkVUgNcAmOzZH10Z9OfPYDJlQgNxJJ+aloYiFtQKuc2+6cT0PwHcMDRICnGKZ+rweMUkI0v9b6fqnZ8OohiSKOVeWwrWqVIKEYZULZryJqdJfZ88LXUoA=="; asn1Primitive = DSSASN1Utils.toASN1Primitive(Utils.fromBase64(certValues)); Attribute certValuesAttibute = new Attribute(PKCSObjectIdentifiers.id_aa_ets_certValues, new DERSet(asn1Primitive)); asn1EncodableVector.add(certValuesAttibute); AttributeTable attributeTable = new AttributeTable(asn1EncodableVector); List<TimeStampToken> timeStampTokens = DSSASN1Utils.findArchiveTimeStampTokens(attributeTable); assertEquals(2, timeStampTokens.size()); }
Example #16
Source File: CAdESSignature.java From dss with GNU Lesser General Public License v2.1 | 5 votes |
private Attribute getSignedAttribute(ASN1ObjectIdentifier oid) { final AttributeTable signedAttributes = signerInformation.getSignedAttributes(); if (signedAttributes == null) { return null; } return signedAttributes.get(oid); }
Example #17
Source File: CadesLevelBaselineLTATimestampExtractor.java From dss with GNU Lesser General Public License v2.1 | 5 votes |
/** * The field unsignedAttrsHashIndex is a sequence of octet strings. Each one contains the hash value of one * instance of Attribute within unsignedAttrs field of the SignerInfo. A hash value for every instance of * Attribute, as present at the time when the corresponding archive time-stamp is requested, shall be included in * unsignedAttrsHashIndex. No other hash values shall be included in this field. * * We check that every hash attribute found in the timestamp token is found if the signerInformation. * * If there is more unsigned attributes in the signerInformation than present in the hash attributes list * (and there is at least the archiveTimestampAttributeV3), we don't report any error nor which attributes are * signed by the timestamp. * If there is some attributes that are not present or altered in the signerInformation, we just return some empty * sequence to make * sure that the timestamped data will not match. We do not report which attributes hash are present if any. * * If there is not attribute at all in the archive timestamp hash index, that would means we didn't check anything. * * @param signerInformation * @param timestampHashIndex * @return */ @SuppressWarnings("unchecked") private ASN1Sequence getVerifiedUnsignedAttributesHashIndex(SignerInformation signerInformation, final ASN1Sequence timestampHashIndex, ASN1ObjectIdentifier atsHashIndexVersionIdentifier) { final ASN1Sequence unsignedAttributesHashes = DSSASN1Utils.getUnsignedAttributesHashIndex(timestampHashIndex); final List<DEROctetString> timestampUnsignedAttributesHashesList = new ArrayList<>(); if (unsignedAttributesHashes != null) { timestampUnsignedAttributesHashesList.addAll(Collections.list(unsignedAttributesHashes.getObjects())); } AttributeTable unsignedAttributes = CMSUtils.getUnsignedAttributes(signerInformation); final ASN1EncodableVector asn1EncodableVector = unsignedAttributes.toASN1EncodableVector(); for (int i = 0; i < asn1EncodableVector.size(); i++) { final Attribute attribute = (Attribute) asn1EncodableVector.get(i); List<DEROctetString> attributeDerOctetStringHashes = getAttributeDerOctetStringHashes(attribute, atsHashIndexVersionIdentifier); for (DEROctetString derOctetStringDigest : attributeDerOctetStringHashes) { final ASN1ObjectIdentifier attrType = attribute.getAttrType(); if (timestampUnsignedAttributesHashesList.remove(derOctetStringDigest)) { // attribute present in signature and in timestamp LOG.debug("Attribute {} present in timestamp", attrType.getId()); } else { LOG.debug("Attribute {} not present in timestamp", attrType.getId()); } } } if (!timestampUnsignedAttributesHashesList.isEmpty()) { LOG.error("{} attribute(s) hash in Timestamp has not been found in document attributes: {}", timestampUnsignedAttributesHashesList.size(), timestampUnsignedAttributesHashesList); // return a empty DERSequence to screw up the hash return new DERSequence(); } // return the original DERSequence return unsignedAttributesHashes; }
Example #18
Source File: DecodedPkiMessage.java From xipki with Apache License 2.0 | 5 votes |
private static Nonce getNonceAttrValue(AttributeTable attrs, ASN1ObjectIdentifier type) throws MessageDecodingException { ASN1Encodable value = ScepUtil.getFirstAttrValue(attrs, type); if (value instanceof ASN1OctetString) { byte[] bytes = ((ASN1OctetString) value).getOctets(); return new Nonce(bytes); } else if (value != null) { throw new MessageDecodingException("the value of attribute " + type.getId() + " is not OctetString"); } else { return null; } }
Example #19
Source File: PkiMessage.java From xipki with Apache License 2.0 | 5 votes |
private AttributeTable getUnsignedAttributes() { if (unsignedAttributes.isEmpty()) { return null; } ASN1EncodableVector vec = new ASN1EncodableVector(); for (ASN1ObjectIdentifier type : unsignedAttributes.keySet()) { addAttribute(vec, type, unsignedAttributes.get(type)); } return new AttributeTable(vec); }
Example #20
Source File: PkiMessage.java From xipki with Apache License 2.0 | 5 votes |
private AttributeTable getSignedAttributes() { ASN1EncodableVector vec = new ASN1EncodableVector(); // messageType addAttribute(vec, ScepObjectIdentifiers.ID_MESSAGE_TYPE, new DERPrintableString(Integer.toString(messageType.getCode()))); // senderNonce addAttribute(vec, ScepObjectIdentifiers.ID_SENDER_NONCE, new DEROctetString(senderNonce.getBytes())); // transactionID addAttribute(vec, ScepObjectIdentifiers.ID_TRANSACTION_ID, new DERPrintableString(transactionId.getId())); // failInfo if (failInfo != null) { addAttribute(vec, ScepObjectIdentifiers.ID_FAILINFO, new DERPrintableString(Integer.toString(failInfo.getCode()))); } // pkiStatus if (pkiStatus != null) { addAttribute(vec, ScepObjectIdentifiers.ID_PKI_STATUS, new DERPrintableString(Integer.toString(pkiStatus.getCode()))); } // recipientNonce if (recipientNonce != null) { addAttribute(vec, ScepObjectIdentifiers.ID_RECIPIENT_NONCE, new DEROctetString(recipientNonce.getBytes())); } for (ASN1ObjectIdentifier type : signedAttributes.keySet()) { addAttribute(vec, type, signedAttributes.get(type)); } return new AttributeTable(vec); }
Example #21
Source File: CAdESLevelBaselineT.java From dss with GNU Lesser General Public License v2.1 | 5 votes |
/** * @param cadesSignature */ private void assertExtendSignaturePossible(CAdESSignature cadesSignature) throws DSSException { final String exceptionMessage = "Cannot extend signature. The signedData is already extended with [%s]."; if (SignatureLevel.CAdES_BASELINE_LTA.equals(cadesSignature.getDataFoundUpToLevel())) { throw new DSSException(String.format(exceptionMessage, "CAdES LTA")); } AttributeTable unsignedAttributes = CMSUtils.getUnsignedAttributes(cadesSignature.getSignerInformation()); if (unsignedAttributes.get(PKCSObjectIdentifiers.id_aa_ets_escTimeStamp) != null) { throw new DSSException(String.format(exceptionMessage, PKCSObjectIdentifiers.id_aa_ets_escTimeStamp.getId())); } }
Example #22
Source File: DSSASN1Utils.java From dss with GNU Lesser General Public License v2.1 | 5 votes |
public static AttributeTable emptyIfNull(AttributeTable original) { if (original == null) { return new AttributeTable(new Hashtable<ASN1ObjectIdentifier, Attribute>()); } else { return original; } }
Example #23
Source File: CAdESLevelBaselineT.java From dss with GNU Lesser General Public License v2.1 | 5 votes |
@Override protected SignerInformation extendCMSSignature(CMSSignedData signedData, SignerInformation signerInformation, CAdESSignatureParameters parameters) throws DSSException { final CAdESSignature cadesSignature = newCAdESSignature(signedData, signerInformation, parameters.getDetachedContents()); assertExtendSignaturePossible(cadesSignature); AttributeTable unsignedAttributes = CMSUtils.getUnsignedAttributes(signerInformation); unsignedAttributes = addSignatureTimestampAttribute(signerInformation, unsignedAttributes, parameters); return SignerInformation.replaceUnsignedAttributes(signerInformation, unsignedAttributes); }
Example #24
Source File: PAdESLevelBExternalSignatureTest.java From dss with GNU Lesser General Public License v2.1 | 5 votes |
private ExternalSignatureResult simulateExternalSignature(ToBeSigned toBeSigned) { ExternalSignatureResult externalSignatureResult = new ExternalSignatureResult(); // Get hold of signature certificate. CertificateToken signingCertificate = getSigningCert(); externalSignatureResult.setSigningCertificate(signingCertificate); DigestAlgorithm digestAlgo = signatureParameters.getDigestAlgorithm(); // Add the signing-certificate/signing-certificate-v2 attribute to DER encoded SignedAttributes. try (ASN1InputStream asn1InputStream = new ASN1InputStream(toBeSigned.getBytes())) { DLSet dlSet = (DLSet) asn1InputStream.readObject(); AttributeTable signedAttribute = new AttributeTable(dlSet); ASN1EncodableVector signedAttributeEncodableVector = signedAttribute.toASN1EncodableVector(); CMSUtils.addSigningCertificateAttribute(signedAttributeEncodableVector, digestAlgo, signingCertificate); DERSet signedAttributesData = new DERSet(signedAttributeEncodableVector); // Update toBeSigned toBeSigned.setBytes(signedAttributesData.getEncoded()); externalSignatureResult.setSignedData(toBeSigned.getBytes()); } catch (Exception e) { LOG.error("Error while simulating external PAdES signature", e); } SignatureValue signatureValue = getToken().sign(toBeSigned, digestAlgo, getSignatureParameters().getMaskGenerationFunction(), getPrivateKeyEntry()); externalSignatureResult.setSignatureValue(signatureValue); return externalSignatureResult; }
Example #25
Source File: CAdESLevelBaselineLTA.java From dss with GNU Lesser General Public License v2.1 | 5 votes |
private AttributeTable addValidationData(AttributeTable unsignedAttributes, final ValidationDataForInclusion validationDataForInclusion, final List<DSSDocument> detachedContents) throws IOException, CMSException, TSPException { TimeStampToken timestampTokenToExtend = getLastArchiveTimestamp(unsignedAttributes); if (timestampTokenToExtend != null) { CMSSignedData timestampCMSSignedData = timestampTokenToExtend.toCMSSignedData(); CMSSignedData extendedTimestampCMSSignedData = cadesProfileLT.extendWithValidationData( timestampCMSSignedData, validationDataForInclusion, detachedContents); unsignedAttributes = replaceTimeStampAttribute(unsignedAttributes, timestampCMSSignedData, extendedTimestampCMSSignedData); } return unsignedAttributes; }
Example #26
Source File: CAdESLevelBaselineLTA.java From dss with GNU Lesser General Public License v2.1 | 5 votes |
private TimeStampToken getLastArchiveTimestamp(AttributeTable unsignedAttributes) { TimeStampToken lastTimeStampToken = null; TimeStampTokenProductionComparator comparator = new TimeStampTokenProductionComparator(); for (TimeStampToken timeStampToken : DSSASN1Utils.findArchiveTimeStampTokens(unsignedAttributes)) { if (lastTimeStampToken == null || comparator.after(timeStampToken, lastTimeStampToken)) { lastTimeStampToken = timeStampToken; } } return lastTimeStampToken; }
Example #27
Source File: PAdESCRLSource.java From dss with GNU Lesser General Public License v2.1 | 5 votes |
private void collectCRLArchivalValues(AttributeTable attributes) { final ASN1Encodable attValue = DSSASN1Utils.getAsn1Encodable(attributes, OID.adbe_revocationInfoArchival); RevocationInfoArchival revValues = PAdESUtils.getRevocationInfoArchivals(attValue); if (revValues != null) { for (final CertificateList revValue : revValues.getCrlVals()) { try { addBinary(CRLUtils.buildCRLBinary(revValue.getEncoded()), RevocationOrigin.ADBE_REVOCATION_INFO_ARCHIVAL); } catch (IOException e) { LOG.warn("Could not convert CertificateList to CRLBinary : {}", e.getMessage()); } } } }
Example #28
Source File: CAdESLevelBExternalSignatureTest.java From dss with GNU Lesser General Public License v2.1 | 5 votes |
private ExternalSignatureResult simulateExternalSignature(ToBeSigned toBeSigned) { ExternalSignatureResult externalSignatureResult = new ExternalSignatureResult(); // Get hold of signature certificate. CertificateToken signingCertificate = getSigningCert(); externalSignatureResult.setSigningCertificate(signingCertificate); DigestAlgorithm digestAlgo = signatureParameters.getDigestAlgorithm(); // Add the signing-certificate/signing-certificate-v2 attribute to DER encoded SignedAttributes. try (ASN1InputStream asn1InputStream = new ASN1InputStream(toBeSigned.getBytes())) { DLSet dlSet = (DLSet) asn1InputStream.readObject(); AttributeTable signedAttribute = new AttributeTable(dlSet); ASN1EncodableVector signedAttributeEncodableVector = signedAttribute.toASN1EncodableVector(); CMSUtils.addSigningCertificateAttribute(signedAttributeEncodableVector, digestAlgo, signingCertificate); DERSet signedAttributesData = new DERSet(signedAttributeEncodableVector); // Update toBeSigned toBeSigned.setBytes(signedAttributesData.getEncoded()); externalSignatureResult.setSignedData(toBeSigned.getBytes()); } catch (Exception e) { LOG.error("Error while simulating external CAdES signature", e); } SignatureValue signatureValue = getToken().sign(toBeSigned, getSignatureParameters().getDigestAlgorithm(), getSignatureParameters().getMaskGenerationFunction(), getPrivateKeyEntry()); externalSignatureResult.setSignatureValue(signatureValue); return externalSignatureResult; }
Example #29
Source File: CMSCertificateSource.java From dss with GNU Lesser General Public License v2.1 | 5 votes |
public void extractSigningCertificateReferences() { AttributeTable signedAttributes = currentSignerInformation.getSignedAttributes(); if (signedAttributes != null && signedAttributes.size() > 0) { final Attribute signingCertificateAttributeV1 = signedAttributes.get(id_aa_signingCertificate); if (signingCertificateAttributeV1 != null) { extractSigningCertificateV1(signingCertificateAttributeV1); } final Attribute signingCertificateAttributeV2 = signedAttributes.get(id_aa_signingCertificateV2); if (signingCertificateAttributeV2 != null) { extractSigningCertificateV2(signingCertificateAttributeV2); } } }
Example #30
Source File: CMSCRLSource.java From dss with GNU Lesser General Public License v2.1 | 5 votes |
private void collectRevocationValues(AttributeTable attributes, ASN1ObjectIdentifier revocationValuesAttribute, RevocationOrigin origin) { final ASN1Encodable attValue = DSSASN1Utils.getAsn1Encodable(attributes, revocationValuesAttribute); RevocationValues revValues = DSSASN1Utils.getRevocationValues(attValue); if (revValues != null) { for (final CertificateList revValue : revValues.getCrlVals()) { addX509CRLHolder(new X509CRLHolder(revValue), origin); } } }