Search in sources :

Example 1 with PasswordBasedKeyProxy

use of org.cloudfoundry.credhub.service.PasswordBasedKeyProxy in project credhub by cloudfoundry-incubator.

the class EncryptionKeyRotatorTest method createOldKey.

private Key createOldKey() throws Exception {
    final PasswordBasedKeyProxy keyProxy = new PasswordBasedKeyProxy("old-password", 1, encryptionService);
    Key oldKey = keyProxy.deriveKey();
    oldCanary = new EncryptionKeyCanary();
    final EncryptedValue canaryEncryption = encryptionService.encrypt(null, oldKey, CANARY_VALUE);
    oldCanary.setEncryptedCanaryValue(canaryEncryption.getEncryptedValue());
    oldCanary.setNonce(canaryEncryption.getNonce());
    oldCanary = encryptionKeyCanaryDataService.save(oldCanary);
    keySet.add(new EncryptionKey(encryptionService, oldCanary.getUuid(), oldKey));
    return oldKey;
}
Also used : EncryptionKeyCanary(org.cloudfoundry.credhub.entity.EncryptionKeyCanary) EncryptionKey(org.cloudfoundry.credhub.service.EncryptionKey) PasswordBasedKeyProxy(org.cloudfoundry.credhub.service.PasswordBasedKeyProxy) EncryptedValue(org.cloudfoundry.credhub.entity.EncryptedValue) EncryptionKey(org.cloudfoundry.credhub.service.EncryptionKey) Key(java.security.Key)

Aggregations

Key (java.security.Key)1 EncryptedValue (org.cloudfoundry.credhub.entity.EncryptedValue)1 EncryptionKeyCanary (org.cloudfoundry.credhub.entity.EncryptionKeyCanary)1 EncryptionKey (org.cloudfoundry.credhub.service.EncryptionKey)1 PasswordBasedKeyProxy (org.cloudfoundry.credhub.service.PasswordBasedKeyProxy)1