• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1RSA OAEP SHA2 vector creation
2=============================
3
4This page documents the code that was used to generate the RSA OAEP SHA2
5test vectors as well as code used to verify them against another
6implementation.
7
8
9Creation
10--------
11
12``cryptography`` was modified to allow the use of SHA2 in OAEP encryption. Then
13the following python script was run to generate the vector files.
14
15.. literalinclude:: /development/custom-vectors/rsa-oaep-sha2/generate_rsa_oaep_sha2.py
16
17Download link: :download:`generate_rsa_oaep_sha2.py
18</development/custom-vectors/rsa-oaep-sha2/generate_rsa_oaep_sha2.py>`
19
20
21Verification
22------------
23
24A Java 8 program was written using `Bouncy Castle`_ to load and verify the test
25vectors.
26
27
28.. literalinclude:: /development/custom-vectors/rsa-oaep-sha2/VerifyRSAOAEPSHA2.java
29
30Download link: :download:`VerifyRSAOAEPSHA2.java
31</development/custom-vectors/rsa-oaep-sha2/VerifyRSAOAEPSHA2.java>`
32
33Using the Verifier
34------------------
35
36Download and install the `Java 8 SDK`_. Initial verification was performed
37using ``jdk-8u77-macosx-x64.dmg``.
38
39Download the latest `Bouncy Castle`_ JAR.  Initial verification was performed
40using ``bcprov-jdk15on-154.jar``.
41
42Set the ``-classpath`` to include the Bouncy Castle jar and the path to
43``VerifyRSAOAEPSHA2.java`` and compile the program.
44
45.. code-block:: console
46
47    $ javac -classpath ~/Downloads/bcprov-jdk15on-154.jar:./ VerifyRSAOAEPSHA2.java
48
49Finally, run the program with the path to the SHA-2 vectors:
50
51.. code-block:: console
52
53    $ java -classpath ~/Downloads/bcprov-jdk15on-154.jar:./ VerifyRSAOAEPSHA2
54
55.. _`Bouncy Castle`: https://www.bouncycastle.org/
56.. _`Java 8 SDK`: https://www.oracle.com/technetwork/java/javase/downloads/index.html
57