This page documents the code that was used to generate the RSA OAEP SHA2 test vectors as well as code used to verify them against another implementation.
cryptography
was modified to allow the use of SHA2 in OAEP encryption. Then the following python script was run to generate the vector files.
/development/custom-vectors/rsa-oaep-sha2/generate_rsa_oaep_sha2.py
Download link: generate_rsa_oaep_sha2.py
</development/custom-vectors/rsa-oaep-sha2/generate_rsa_oaep_sha2.py>
A Java 8 program was written using Bouncy Castle to load and verify the test vectors.
/development/custom-vectors/rsa-oaep-sha2/VerifyRSAOAEPSHA2.java
Download link: VerifyRSAOAEPSHA2.java
</development/custom-vectors/rsa-oaep-sha2/VerifyRSAOAEPSHA2.java>
Download and install the Java SDK. Initial verification was performed using jdk-8u77-macosx-x64.dmg
.
Download the latest Bouncy Castle JAR. Initial verification was performed using bcprov-jdk15on-154.jar
.
Set the -classpath
to include the Bouncy Castle jar and the path to VerifyRSAOAEPSHA2.java
and compile the program.
$ javac -classpath ~/Downloads/bcprov-jdk15on-154.jar:./ VerifyRSAOAEPSHA2.java
Finally, run the program with the path to the SHA-2 vectors:
$ java -classpath ~/Downloads/bcprov-jdk15on-154.jar:./ VerifyRSAOAEPSHA2