Search in sources :

Example 1 with SignatureKeyImpl

use of org.eclipse.che.multiuser.machine.authentication.server.signature.model.impl.SignatureKeyImpl in project devspaces-images by redhat-developer.

the class SignatureKeyManagerTest method shouldThrowsExceptionWhenAlgorithmIsNotSupported.

@Test(expectedExceptions = SignatureKeyManagerException.class)
public void shouldThrowsExceptionWhenAlgorithmIsNotSupported() throws Exception {
    final SignatureKeyImpl publicKey = new SignatureKeyImpl(new byte[] {}, "ECDH", "PKCS#15");
    final SignatureKeyImpl privateKey = new SignatureKeyImpl(new byte[] {}, "ECDH", "PKCS#3");
    final SignatureKeyPairImpl kp = new SignatureKeyPairImpl("id_" + 1, publicKey, privateKey);
    doReturn(kp).when(signatureKeyDao).get(anyString());
    signatureKeyManager.getOrCreateKeyPair("ws1");
    verify(signatureKeyDao).get(anyString());
}
Also used : SignatureKeyImpl(org.eclipse.che.multiuser.machine.authentication.server.signature.model.impl.SignatureKeyImpl) SignatureKeyPairImpl(org.eclipse.che.multiuser.machine.authentication.server.signature.model.impl.SignatureKeyPairImpl) Test(org.testng.annotations.Test)

Example 2 with SignatureKeyImpl

use of org.eclipse.che.multiuser.machine.authentication.server.signature.model.impl.SignatureKeyImpl in project che-server by eclipse-che.

the class SignatureKeyManagerTest method shouldThrowsExceptionWhenAlgorithmIsNotSupported.

@Test(expectedExceptions = SignatureKeyManagerException.class)
public void shouldThrowsExceptionWhenAlgorithmIsNotSupported() throws Exception {
    final SignatureKeyImpl publicKey = new SignatureKeyImpl(new byte[] {}, "ECDH", "PKCS#15");
    final SignatureKeyImpl privateKey = new SignatureKeyImpl(new byte[] {}, "ECDH", "PKCS#3");
    final SignatureKeyPairImpl kp = new SignatureKeyPairImpl("id_" + 1, publicKey, privateKey);
    doReturn(kp).when(signatureKeyDao).get(anyString());
    signatureKeyManager.getOrCreateKeyPair("ws1");
    verify(signatureKeyDao).get(anyString());
}
Also used : SignatureKeyImpl(org.eclipse.che.multiuser.machine.authentication.server.signature.model.impl.SignatureKeyImpl) SignatureKeyPairImpl(org.eclipse.che.multiuser.machine.authentication.server.signature.model.impl.SignatureKeyPairImpl) Test(org.testng.annotations.Test)

Aggregations

SignatureKeyImpl (org.eclipse.che.multiuser.machine.authentication.server.signature.model.impl.SignatureKeyImpl)2 SignatureKeyPairImpl (org.eclipse.che.multiuser.machine.authentication.server.signature.model.impl.SignatureKeyPairImpl)2 Test (org.testng.annotations.Test)2