use of org.cloudfoundry.credhub.entity.CertificateCredentialVersionData in project credhub by cloudfoundry-incubator.
the class CredentialRotationTest method rotate_givenCertificateCredential_reEncryptsWithActiveKey.
@Test
public void rotate_givenCertificateCredential_reEncryptsWithActiveKey() {
CertificateCredentialVersionData certificateCredentialData = new CertificateCredentialVersionData("some-name");
CertificateCredentialVersion credential = new CertificateCredentialVersion(certificateCredentialData);
assertRotation(credential, certificateCredentialData);
}
use of org.cloudfoundry.credhub.entity.CertificateCredentialVersionData in project credhub by cloudfoundry-incubator.
the class EncryptionKeyRotatorTest method createCertificateWithOldKey.
private void createCertificateWithOldKey(Key oldKey) throws Exception {
final EncryptedValue encryption = encryptionService.encrypt(oldCanary.getUuid(), oldKey, "old-certificate-private-key");
CertificateCredentialVersionData certificateCredentialData1 = new CertificateCredentialVersionData("/old-key");
certificateCredentialData1.setEncryptedValueData(encryption);
credentialVersionWithOldKey = new CertificateCredentialVersion(certificateCredentialData1);
credentialVersionDataService.save(credentialVersionWithOldKey);
}
use of org.cloudfoundry.credhub.entity.CertificateCredentialVersionData in project credhub by cloudfoundry-incubator.
the class CertificateVersionDataService method unsetTransitionalVerison.
public void unsetTransitionalVerison(UUID certificateUuid) {
CertificateCredentialVersionData transitionalCertificate = (CertificateCredentialVersionData) credentialVersionRepository.findTransitionalCertificateVersion(certificateUuid);
if (transitionalCertificate != null) {
transitionalCertificate.setTransitional(false);
credentialVersionRepository.save(transitionalCertificate);
}
}
use of org.cloudfoundry.credhub.entity.CertificateCredentialVersionData in project credhub by cloudfoundry-incubator.
the class CredentialVersionDataServiceTest method setupTestFixturesForFindContainingName.
private void setupTestFixturesForFindContainingName(String valueName, String passwordName, String certificateName) {
fakeTimeSetter.accept(2000000000123L);
valueCredentialData = new ValueCredentialVersionData(valueName);
valueCredentialData.setEncryptedValueData(new EncryptedValue().setEncryptionKeyUuid(activeCanaryUuid).setEncryptedValue("value".getBytes()).setNonce(new byte[] {}));
ValueCredentialVersion namedValueCredential = new ValueCredentialVersion(valueCredentialData);
namedValueCredential.setEncryptor(encryptor);
subject.save(namedValueCredential);
PasswordCredentialVersionData passwordCredentialData = new PasswordCredentialVersionData("/mySe.cret");
passwordCredentialData.setEncryptedValueData(new EncryptedValue(activeCanaryUuid, "", ""));
new PasswordCredentialVersion(passwordCredentialData);
PasswordCredentialVersion namedPasswordCredential;
subject.save(namedValueCredential);
fakeTimeSetter.accept(1000000000123L);
passwordCredentialData = new PasswordCredentialVersionData(passwordName);
passwordCredentialData.setEncryptedValueData(new EncryptedValue().setEncryptionKeyUuid(activeCanaryUuid).setEncryptedValue("password".getBytes()).setNonce(new byte[] {}));
namedPasswordCredential = new PasswordCredentialVersion(passwordCredentialData);
subject.save(namedPasswordCredential);
CertificateCredentialVersionData certificateCredentialData = new CertificateCredentialVersionData("/myseecret");
CertificateCredentialVersion certificateCredential = new CertificateCredentialVersion(certificateCredentialData);
subject.save(certificateCredential);
fakeTimeSetter.accept(3000000000123L);
certificateCredentialData = new CertificateCredentialVersionData(certificateName);
certificateCredential = new CertificateCredentialVersion(certificateCredentialData);
subject.save(certificateCredential);
}
use of org.cloudfoundry.credhub.entity.CertificateCredentialVersionData in project credhub by cloudfoundry-incubator.
the class CredentialVersionDataServiceTest method saveCertificate.
private CertificateCredentialVersion saveCertificate(long timeMillis, String name, String caName, UUID canaryUuid, boolean transitional) {
fakeTimeSetter.accept(timeMillis);
Credential credential = credentialDataService.find(name);
if (credential == null) {
credential = credentialDataService.save(new Credential(name));
}
CertificateCredentialVersionData credentialObject = new CertificateCredentialVersionData();
credentialObject.setCredential(credential);
credentialObject.setEncryptedValueData(new EncryptedValue().setEncryptionKeyUuid(canaryUuid).setEncryptedValue(new byte[] {}).setNonce(new byte[] {}));
if (caName != null) {
credentialObject.setCaName(caName);
}
credentialObject.setTransitional(transitional);
return subject.save(credentialObject);
}
Aggregations