@Test public void cmsSignedDataEqualTest() throws Exception { String tstBase64 = "MIIJWwYJKoZIhvcNAQcCoIIJTDCCCUgCAQMxDzANBglghkgBZQMEAgMFADCB/gYLKoZIhvcNAQkQAQSgge4EgeswgegCAQEGBgQAj2cBATAxMA0GCWCGSAFlAwQCAQUABCCn0cRUUvQwpjtFZ8VAx0nzxzu3gZ2Ymqcp87qgiY/4OQIIXuTHubzkaM4YDzIwMjAwNDExMTIzNDQwWjADAgEBAgiO+SBfQ41ZO6B+pHwwejEnMCUGA1UEAwweU0sgVElNRVNUQU1QSU5HIEFVVEhPUklUWSAyMDIwMRcwFQYDVQRhDA5OVFJFRS0xMDc0NzAxMzEMMAoGA1UECwwDVFNBMRswGQYDVQQKDBJTSyBJRCBTb2x1dGlvbnMgQVMxCzAJBgNVBAYTAkVFoIIEGjCCBBYwggL+oAMCAQICEGI2fXRa2UOrXaRQuV4/+m4wDQYJKoZIhvcNAQELBQAwdTELMAkGA1UEBhMCRUUxIjAgBgNVBAoMGUFTIFNlcnRpZml0c2VlcmltaXNrZXNrdXMxKDAmBgNVBAMMH0VFIENlcnRpZmljYXRpb24gQ2VudHJlIFJvb3QgQ0ExGDAWBgkqhkiG9w0BCQEWCXBraUBzay5lZTAeFw0xOTEyMzEyMjAwMDBaFw0yNDEyMzEyMjAwMDBaMHoxJzAlBgNVBAMMHlNLIFRJTUVTVEFNUElORyBBVVRIT1JJVFkgMjAyMDEXMBUGA1UEYQwOTlRSRUUtMTA3NDcwMTMxDDAKBgNVBAsMA1RTQTEbMBkGA1UECgwSU0sgSUQgU29sdXRpb25zIEFTMQswCQYDVQQGEwJFRTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMXTh6Dv8RAF1WHepuuEISh6DWYU+S/sBJDufQx+CvJVta byte[] tstBinaries = Utils.fromBase64(tstBase64); ASN1Primitive asn1Primitive = DSSASN1Utils.toASN1Primitive(tstBinaries); Attribute atstV3Attibute = new Attribute(OID.id_aa_ets_archiveTimestampV3, new DERSet(asn1Primitive)); CMSSignedData cmsSignedData = DSSASN1Utils.getCMSSignedData(atstV3Attibute); assertFalse(Arrays.equals(atstV3Attibute.getEncoded(), cmsSignedData.getEncoded())); assertTrue(CMSUtils.isCMSSignedDataEqual(cmsSignedData, DSSASN1Utils.getCMSSignedData(atstV3Attibute))); String berEncodedTST = "MIAGCSqGSIb3DQEHAqCAMIIIEwIBAzEPMA0GCWCGSAFlAwQCAwUAMIHdBgsqhkiG9w0BCRABBKCBzQSByjCBxwIBAQYGBACPZwEBMDEwDQYJYIZIAWUDBAIBBQAEIEx1HyJIzqt0xr8QBSNv5cRNSOac6X22MCn43LTUSuGQAgh47MXImQeQxBgPMjAxOTAyMTgxNDEyMjlaMAMCAQGgZ6RlMGMxCzAJBgNVBAYTAkVFMSIwIAYDVQQKDBlBUyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMQwwCgYDVQQLDANUU0ExIjAgBgNVBAMMGVNLIFRJTUVTVEFNUElORyBBVVRIT1JJVFmgggQRMIIEDTCCAvWgAwIBAgIQJK/s6xJo0AJUF/eG7W8BWTANBgkqhkiG9w0BAQsFADB1MQswCQYDVQQGEwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1czEoMCYGA1UEAwwfRUUgQ2VydGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYGCSqGSIb3DQEJARYJcGtpQHNrLmVlMB4XDTE0MDkxNjA4NDAzOFoXDTE5MDkxNjA4NDAzOFowYzELMAkGA1UEBhMCRUUxIjAgBgNVBAoMGUFTIFNlcnRpZml0c2VlcmltaXNrZXNrdXMxDDAKBgNVBAsMA1RTQTEiMCAGA1UEAwwZU0sgVElNRVNUQU1QSU5HIEFVVEhPUklUWTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJPa/dQKemSKCNSwlMUp9YKQY6zQOfs9vgUnbzTRHCRBRdsabZYknxTI4DqQ5+JPqw8MTkDvb6nfDZGd15t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TANBglghkgBZQMEAgMFAKCCAU0wGgYJKoZIhvcNAQkDMQ0GCyqGSIb3DQEJEAEEMBwGCSqGSIb3DQEJBTEPFw0xOTAyMTgxNDEyMjlaME8GCSqGSIb3DQEJBDFCBEAQowCFbttXzzmOv1nPKZ5V5Ju/vVB8fXGBlGofbvyAFZ0XMpuLOQVvtjCnrQ8VPtraSf87xHAk+DmAQhRCsO/rMIG/BgsqhkiG9w0BCRACDDGBrzCBrDCBqTCBpgQUstAhgvC5biocaH7OMjQII5gZMLYwgY0weaR3MHUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKDBlBUyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMSgwJgYDVQQDDB9FRSBDZXJ0aWZpY2F0aW9uIENlbnRyZSBSb290IENBMRgwFgYJKoZIhvcNAQkBFglwa2lAc2suZWUCECSv7OsSaNACVBf3hu1vAVkwDQYJKoZIhvcNAQEBBQAEggEAZIeCPyWt1WsuHwUJjL assertFalse(CMSUtils.isCMSSignedDataEqual(cmsSignedData, new CMSSignedData(Utils.fromBase64(berEncodedTST)))); }
public static boolean isCMSSignedDataEqual(CMSSignedData signedData, CMSSignedData signedDataToCompare) throws IOException { return Arrays.equals(signedData.getEncoded(), signedDataToCompare.getEncoded()); }
CMSUtils { public static boolean isCMSSignedDataEqual(CMSSignedData signedData, CMSSignedData signedDataToCompare) throws IOException { return Arrays.equals(signedData.getEncoded(), signedDataToCompare.getEncoded()); } }
CMSUtils { public static boolean isCMSSignedDataEqual(CMSSignedData signedData, CMSSignedData signedDataToCompare) throws IOException { return Arrays.equals(signedData.getEncoded(), signedDataToCompare.getEncoded()); } private  CMSUtils(); }
CMSUtils { public static boolean isCMSSignedDataEqual(CMSSignedData signedData, CMSSignedData signedDataToCompare) throws IOException { return Arrays.equals(signedData.getEncoded(), signedDataToCompare.getEncoded()); } private  CMSUtils(); static CMSSignedData generateCMSSignedData(final CMSSignedDataGenerator generator, final CMSTypedData content, final boolean encapsulate); static CMSSignedData generateDetachedCMSSignedData(final CMSSignedDataGenerator generator, final CMSProcessableByteArray content); static DERTaggedObject getDERSignedAttributes(final SignerInformation signerInformation); static byte[] getSignedContent(final CMSTypedData cmsTypedData); static AttributeTable getUnsignedAttributes(final SignerInformation signerInformation); static AttributeTable getSignedAttributes(final SignerInformation signerInformation); static AttributeTable getAttributesFromByteArray(final byte[] encodedAttributes); static void addSigningCertificateAttribute(final ASN1EncodableVector signedAttributes, final DigestAlgorithm digestAlgorithm,
			CertificateToken signingToken); static boolean isCMSSignedDataEqual(CMSSignedData signedData, CMSSignedData signedDataToCompare); static Attribute getUnsignedAttribute(SignerInformation signerInformation, ASN1ObjectIdentifier oid); static boolean isDetachedSignature(CMSSignedData cmsSignedData); static DSSDocument getOriginalDocument(CMSSignedData cmsSignedData, List<DSSDocument> detachedDocuments); static CMSTypedData getContentToBeSign(final DSSDocument toSignData); }
CMSUtils { public static boolean isCMSSignedDataEqual(CMSSignedData signedData, CMSSignedData signedDataToCompare) throws IOException { return Arrays.equals(signedData.getEncoded(), signedDataToCompare.getEncoded()); } private  CMSUtils(); static CMSSignedData generateCMSSignedData(final CMSSignedDataGenerator generator, final CMSTypedData content, final boolean encapsulate); static CMSSignedData generateDetachedCMSSignedData(final CMSSignedDataGenerator generator, final CMSProcessableByteArray content); static DERTaggedObject getDERSignedAttributes(final SignerInformation signerInformation); static byte[] getSignedContent(final CMSTypedData cmsTypedData); static AttributeTable getUnsignedAttributes(final SignerInformation signerInformation); static AttributeTable getSignedAttributes(final SignerInformation signerInformation); static AttributeTable getAttributesFromByteArray(final byte[] encodedAttributes); static void addSigningCertificateAttribute(final ASN1EncodableVector signedAttributes, final DigestAlgorithm digestAlgorithm,
			CertificateToken signingToken); static boolean isCMSSignedDataEqual(CMSSignedData signedData, CMSSignedData signedDataToCompare); static Attribute getUnsignedAttribute(SignerInformation signerInformation, ASN1ObjectIdentifier oid); static boolean isDetachedSignature(CMSSignedData cmsSignedData); static DSSDocument getOriginalDocument(CMSSignedData cmsSignedData, List<DSSDocument> detachedDocuments); static CMSTypedData getContentToBeSign(final DSSDocument toSignData); static final DigestAlgorithm DEFAULT_ARCHIVE_TIMESTAMP_HASH_ALGO; }