Search in sources :

Example 11 with CertificateCredentialVersionData

use of org.cloudfoundry.credhub.entity.CertificateCredentialVersionData in project credhub by cloudfoundry-incubator.

the class CertificateCredentialVersionTest method setup.

@Before
public void setup() {
    TestHelper.getBouncyCastleProvider();
    encryptor = mock(Encryptor.class);
    encryptedValue = "fake-encrypted-value".getBytes();
    nonce = "fake-nonce".getBytes();
    canaryUuid = UUID.randomUUID();
    final EncryptedValue encryption = new EncryptedValue(canaryUuid, encryptedValue, nonce);
    when(encryptor.encrypt("my-priv")).thenReturn(encryption);
    when(encryptor.decrypt(encryption)).thenReturn("my-priv");
    certificateCredentialData = new CertificateCredentialVersionData("/Foo");
    subject = new CertificateCredentialVersion(certificateCredentialData).setEncryptor(encryptor).setCa("my-ca").setCertificate("my-cert").setPrivateKey("my-priv");
}
Also used : CertificateCredentialVersionData(org.cloudfoundry.credhub.entity.CertificateCredentialVersionData) EncryptedValue(org.cloudfoundry.credhub.entity.EncryptedValue) Before(org.junit.Before)

Aggregations

CertificateCredentialVersionData (org.cloudfoundry.credhub.entity.CertificateCredentialVersionData)11 EncryptedValue (org.cloudfoundry.credhub.entity.EncryptedValue)5 CertificateCredentialVersion (org.cloudfoundry.credhub.domain.CertificateCredentialVersion)4 Test (org.junit.Test)4 Credential (org.cloudfoundry.credhub.entity.Credential)3 PasswordCredentialVersion (org.cloudfoundry.credhub.domain.PasswordCredentialVersion)2 ValueCredentialVersion (org.cloudfoundry.credhub.domain.ValueCredentialVersion)2 PasswordCredentialVersionData (org.cloudfoundry.credhub.entity.PasswordCredentialVersionData)2 ValueCredentialVersionData (org.cloudfoundry.credhub.entity.ValueCredentialVersionData)2 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 Before (org.junit.Before)1 DataJpaTest (org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest)1 MockHttpServletRequestBuilder (org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder)1