ASN1_SIMPLE(CMS_AuthenticatedData, macAlgorithm, X509_ALGOR),
ASN1_IMP(CMS_AuthenticatedData, digestAlgorithm, X509_ALGOR, 1),
ASN1_SIMPLE(CMS_AuthenticatedData, encapContentInfo, CMS_EncapsulatedContentInfo),
- ASN1_IMP_SET_OF_OPT(CMS_AuthenticatedData, authAttrs, X509_ALGOR, 2),
+ ASN1_IMP_SET_OF_OPT(CMS_AuthenticatedData, authAttrs, X509_ATTRIBUTE, 2),
ASN1_SIMPLE(CMS_AuthenticatedData, mac, ASN1_OCTET_STRING),
- ASN1_IMP_SET_OF_OPT(CMS_AuthenticatedData, unauthAttrs, X509_ALGOR, 3)
+ ASN1_IMP_SET_OF_OPT(CMS_AuthenticatedData, unauthAttrs, X509_ATTRIBUTE, 3)
} static_ASN1_NDEF_SEQUENCE_END(CMS_AuthenticatedData)
ASN1_NDEF_SEQUENCE(CMS_CompressedData)
$no_rc2 = 1 if disabled("legacy");
-plan tests => 40;
+plan tests => 41;
ok(run(test(["pkcs7_test"])), "test pkcs7");
"tampered authEnvelopedData leaks no plaintext to -out");
};
+subtest "CMS parse authenticatedData authAttrs and unauthAttrs\n" => sub {
+ plan tests => 3;
+
+ # BouncyCastle authenticatedData (HMAC-SHA256, KEK) carrying both an
+ # authenticated and an unauthenticated attribute. Per RFC 5652 these are
+ # SET OF Attribute, so with the CMS_AuthenticatedData template fixed to use
+ # X509_ATTRIBUTE they are rendered as attributes (object:/set:) rather than
+ # as an X509_ALGOR (algorithm:/parameter:) they were misparsed into before.
+ my $exit = 0;
+ my $dump = join "\n",
+ run(app(["openssl", "cms", @defaultprov, "-cmsout", "-noout",
+ "-print", "-inform", "PEM",
+ "-in", catfile($datadir, "authenticated_attrs.pem")]),
+ capture => 1,
+ statusvar => $exit);
+
+ is($exit, 0, "parse authenticatedData with attributes");
+ ok($dump =~ /authAttrs:.*?object:.*?1\.3\.6\.1\.4\.1\.5949\.99\.1.*?UTF8STRING:auth-attr-value/s,
+ "authAttrs parsed as SET OF Attribute");
+ ok($dump =~ /unauthAttrs:.*?object:.*?1\.3\.6\.1\.4\.1\.5949\.99\.2.*?UTF8STRING:unauth-attr-value/s,
+ "unauthAttrs parsed as SET OF Attribute");
+};
+
subtest "CAdES <=> CAdES consistency tests\n" => sub {
plan tests => (scalar @smime_cms_cades_tests);
--- /dev/null
+-----BEGIN CMS-----
+MIAGCyqGSIb3DQEJEAECoIAwgAIBADFDokECAQQwBQQDwP7gMAsGCWCGSAFlAwQB
+BQQoWM396pUOzWW6mFsNvr+XXTLufCrvzG3jiTOX+l3LpSXbXHhhpadw5DAMBggq
+hkiG9w0CCQUAoQsGCWCGSAFlAwQCATCABgkqhkiG9w0BBwGggCSABB5IZWxsbyBB
+dXRoZW50aWNhdGVkRGF0YSB3b3JsZAoAAAAAAACiIDAeBgkrBgEEAa49YwExEQwP
+YXV0aC1hdHRyLXZhbHVlBCB9kCl8ic3e5461oodeDSyR7heZxtdN7G/N+oqerDIj
+PqMiMCAGCSsGAQQBrj1jAjETDBF1bmF1dGgtYXR0ci12YWx1ZQAAAAAAAA==
+-----END CMS-----