Overview

GordianKnot provide three kinds of locks that are password protected.

  1. keySetLocks are provided to secure a randomly generated keySet using a password.
  2. factoryLocks are provided to secure a randomly generated factory using a password.
  3. keyPairLocks are provided to secure a randomly generated keySet using a password and a private asymmetric key.

keySetLock

A keySetLock can be either be used to secure an existing keySet, or it can be used to create a new random keySet.

Sample

                    /* Access factory */
                    final GordianFactory myBaseFactory = GordianGenerator.createFactory();
                    final GordianLockFactory myLockFactory = myBaseFactory.getLockFactory();

                    /* Create a lock for a new keySet */
                    final GordianPasswordLockSpec mySpec = new GordianPasswordLockSpec(new GordianKeySetSpec(GordianLength.LEN_256));
                    final char[] myPassword = ...
                    final GordianKeySetLock myLock = myLockFactory.newKeySetLock(mySpec, myPassword);
                    final GordianKeySet myKeySet = myLock.getKeySet();
                    final byte[] myLockBytes = myLock.getLockBytes();

                    /* Resolve the lock */
                    final GordianKeySetLock myResolved = myLockFactory.resolveKeySetLock(myLockBytes, myPassword);
                

factoryLock

A keySetLock can either be used to secure an existing factory, or it can be used to create a new random factory.

Sample

                    /* Access factory */
                    final GordianFactory myBaseFactory = GordianGenerator.createFactory();
                    final GordianLockFactory myLockFactory = myBaseFactory.getLockFactory();

                    /* Create a lock for a new factory */
                    final GordianPasswordLockSpec mySpec = new GordianPasswordLockSpec(new GordianKeySetSpec(GordianLength.LEN_256));
                    final char[] myPassword = ...
                    final GordianFactoryLock myLock = myLockFactory.newFactoryLock(mySpec, myPassword);
                    final GordianFactory myFactory = myLock.getFactory();
                    final GordianKeySet myKeySet = myFactory.getEmbeddedKeySet();
                    final byte[] myLockBytes = myLock.getLockBytes();

                    /* Resolve the lock */
                    final GordianFactpryLock myResolved = myLockFactory.resolveFactoryLock(myLockBytes, myPassword);
                

keyPairLock

A keyPairLock can be used to create a new secured random keySet using an agreement-capable keypair.

Sample

                    /* Access factory */
                    final GordianFactory myBaseFactory = GordianGenerator.createFactory();
                    final GordianLockFactory myLockFactory = myBaseFactory.getLockFactory();
                    final GordianKeyPairFactory myKeyPairFactory = myBase.getKeyPairFactory();
                    final GordianAgreementFactory myAgreementFactory = myKeyPairFactory.getAgreementFactory();

                    /* Access keyPairGenerator and create sending/receiving pairs */
                    final GordianKeyPairSpec mySpec = GordianKeyPairSpec.dh(GordianDHGroup.FFDHE2048);
                    final GordianKeyPairGenerator myGenerator = myKeyPairFactory.getKeyPairGenerator(mySpec);
                    final GordianKeyPair myKeyPair = myGenerator.generateKeyPair();

                    /* Create a lock for a new keySet */
                    final GordianPasswordLockSpec mySpec = new GordianPasswordLockSpec(new GordianKeySetSpec(GordianLength.LEN_256));
                    final char[] myPassword = ...
                    final GordianKeyPairLock myLock = myLockFactory.newKeyPairLock(mySpec, myKeyPair, myPassword);
                    final GordianKeySet myKeySet = myLock.getKeySet();
                    final byte[] myLockBytes = myLock.getLockBytes();

                    /* Resolve the lock */
                    final GordianKeyPairLock myResolved = myLockFactory.resolveKeyPairLock(myLockBytes, myKeyPair, myPassword);