Class KeyPairReader

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class KeyPairReader
    extends Object
    implements Closeable
    Class to read a key from file. The class can be used in the application to load the public key, and it is also used in the repl application. Note that the applications that need to validate a license can only read the public key. The environment (client machine) where the license is checked should not have the private key available and hence it cannot be read.

    Create an instance of this class using one of the constructors specifying the source of the license key and then use one of the read...() methods to read the key into a LicenseKeyPair object.

    Note: the class file is named KeyPairReader because it is the reading part of the class KeyPairWriter. However, this class reads one key at a time and not a pair. The keys, when created are written in pairs to save them, but then only one is read when encoding or decoding. On the other hand the return value of the read methods are LicenseKeyPair objects that are filled with either a public or private key and the other key in these objects are null.