UTIL

The KeyDirectory

How to specify sources for Public and Private Keys

The class KeyDirectory has two init() methods that take either one or two references to KeyDirectoryInterface implementers. If init() is called with only one reference, it is assumed that the single interface is responsible for providing both Public and Private Keys. Otherwise, the first of the two is set as the provider of Public Keys, and the second is set as the provider of Private Keys.

How to make a keys_file

Disco has provided a utility to generate Public/Private Key pairs using Bouncy Castle's implementation of the
Java RSA CRT key interfaces. The application code is in edu.nyu.cs.pdsg.util.MakeKeys, and there are two existing copies of the script in the repositories that run this code: util/utilscripts/makekeys.sh and discodemo6/scripts/makekeys.sh.

The script takes as arguments a source file name and a destination file name. The source is an existing file that contains a line-separated list of Entity names for keys. The script will generate a new destination file that contains plain-text representations of the keys, one per line. The format of the key entries is as follows:

[name] [key type, i.e. the fully qualified name of the key Class] [key component integer representation]+
In the case of the current Bouncy Castle RSA CRT implementation, the line format is as follows:
[name] org.bouncycastle.jce.provider.JCERSAPrivateCrtKey [modulus] [public exponent] [private exponent] [prime P] [prime Q] [prime exponent P] [prime exponent Q] [CRT coefficient]
The class that generates this text representation of the key is the util class RSACrtKeyReaderWriter, which implements KeyReaderWriter. If it becomes necessary to implement a new key format, MakeKeys will work using a new KeyReaderWriter implementation.