-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wire-up ACVP Testing for SHA3 Signatures with RSA (#1805)
### Description of changes: Enables ACVP testing of SHA3 signatures with RSA for PKCS#1.5 signatures and PSS signatures. ### How are new algorithms added to `kPKCS1SigPrefixes`? This is my outline of how I generated the prefixes for additional algorithms: For each algorithm: 1. Generate an arbitrary digest using the digest algorithm ``` $ echo -n "" | openssl sha3-256 SHA3-256(stdin)= a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a ``` 2. Make a file with the ASN.1 definition and content, being sure to set `id` to the correct algorithm OID name, and `digest` to the arbitrary digest from step 1. ``` $ cat > ~/encoding.txt <<EOF asn1 = SEQUENCE:info [info] alg = SEQUENCE:alg digest = FORMAT:HEX,OCT:a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a [alg] id = OID:SHA3-256 param = NULL EOF ``` 3. Generate the output DER using the definition defined in step 4 ``` $ openssl asn1parse -genconf ~/encoding.txt -out ~/encoding.der ``` 4. Output the DER encoding in hex format suitable for C ``` $ xxd -i < ~/encoding.der 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x08, 0x05, 0x00, 0x04, 0x20, 0xa7, 0xff, 0xc6, 0xf8, 0xbf, 0x1e, 0xd7, 0x66, 0x51, 0xc1, 0x47, 0x56, 0xa0, 0x61, 0xd6, 0x62, 0xf5, 0x80, 0xff, 0x4d, 0xe4, 0x3b, 0x49, 0xfa, 0x82, 0xd8, 0x0a, 0x4b, 0x80, 0xf8, 0x43, 0x4a ``` 5. Finally, strip out off the bytes from the end that are the digest hash produced in step 1 and used in step 2. This is your final prefix bytes to use with `kPKCS1SigPrefixes`. ``` 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x08, 0x05, 0x00, 0x04, 0x20 ``` By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.
- Loading branch information
Showing
6 changed files
with
274 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.