tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

README (2707B)


      1 This directory contains a set of tests for each cipher supported by
      2 BLAPI.  Each subdirectory contains known plaintext and ciphertext pairs
      3 (and keys and/or iv's if needed).  The tests can be run as a full set
      4 with:
      5     bltest -T
      6 or as subsets, for example:
      7     bltest -T -m des_ecb,md2,rsa
      8 
      9 In each subdirectory, the plaintext, key, and iv are ascii, and treated
     10 as such.  The ciphertext is base64-encoded to avoid the hassle of binary
     11 files.
     12 
     13 To add a test, incremement the value in the numtests file.  Create a
     14 plaintext, key, and iv file, such that the name of the file is
     15 incrememted one from the last set of tests.  For example, if you are
     16 adding the second test, put your data in files named plaintext1, key1,
     17 and iv1 (ignoring key and iv if they are not needed, of course).  Make
     18 sure your key and iv are the correct number of bytes for your cipher (a
     19 trailing \n is okay, but any other trailing bytes will be used!).  Once
     20 you have your input data, create output data by running bltest on a
     21 trusted implementation.  For example, for a new DES ECB test, run
     22     bltest -E -m des_ecb -i plaintext1 -k key1 -o ciphertext1 -a in the
     23 tests/des_ecb directory.  Then run
     24     bltest -T des_ecb from the cmd/bltest directory in the tree of the
     25 implementation you want to test.
     26 
     27 Note that the -a option above is important, it tells bltest to expect
     28 the input to be straight ASCII, and not base64 encoded binary!
     29 
     30 Special cases:
     31 
     32 RC5:
     33 RC5 can take additional parameters, the number of rounds to perform and
     34 the wordsize to use.  The number of rounds is between is between 0 and
     35 255, and the wordsize is either is either 16, 32, or 64 bits (at this
     36 time only 32-bit is supported).  These parameters are specified in a
     37 paramsN file, where N is an index as above.  The format of the file is
     38 "rounds=R\nwordsize=W\n".
     39 
     40 public key modes (RSA and DSA):
     41 Asymmetric key ciphers use keys with special properties, so creating a
     42 key file with "Mozilla!" in it will not get you very far!  To create a
     43 public key, run bltest with the plaintext you want to encrypt, using a
     44 trusted implementation.  bltest will generate a key and store it in
     45 "tmp.key", rename that file to keyN.  For example:
     46     bltest -E -m rsa -i plaintext0 -o ciphertext0 -e 65537 -g 32 -a
     47     mv tmp.key key0
     48 
     49 RSA-OAEP/RSA-PSS:
     50 RSA-OAEP and RSA-PSS have a number of additional parameters to feed in.
     51 - "seedN": The seed or salt to use when encrypting/signing
     52 - "hashN" / "maskhashN" - The base digest algorithm and the digest algorithm
     53    to use with MGF1, respectively. This should be an ASCII string specifying
     54    one of the hash algorithms recognized by bltest (eg: "sha1", "sha256")
     55 
     56 [note: specifying a keysize (-g) when using RSA is important!]