Skip to content

Commit

Permalink
Added two new tests for KeyStoreService and one test for CmsEncryptio…
Browse files Browse the repository at this point in the history
…nServiceImpl
  • Loading branch information
Thendo20 committed Jul 1, 2024
1 parent 19b3408 commit d3ced01
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ void cmsStreamEnvelopeEncryptAndDecryptTestCustom() {

KeyStoreAuth keyStoreAuth = new KeyStoreAuth(readStorePassword, readKeyPassword);
KeyCreationConfig config = KeyCreationConfig.builder()
.signing(KeyCreationConfig.SigningKeyCreationCfg.builder().algo("RSA").size(2048).sigAlgo( "SHA256withRSA").curve("null").build())
.encrypting(KeyCreationConfig.EncryptingKeyCreationCfg.builder().algo("RSA").size(2048).sigAlgo("SHA256withRSA").curve("null").build())
.signing(KeyCreationConfig.SigningKeyCreationCfg.builder().algo("RSA").size(2048).sigAlgo( "SHA256withRSA").curve(null).build())
.encrypting(KeyCreationConfig.EncryptingKeyCreationCfg.builder().algo("RSA").size(2048).sigAlgo("SHA256withRSA").curve(null).build())
.build();

KeyStore keyStore = keyStoreService.createKeyStore(keyStoreAuth, config);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import javax.crypto.SecretKey;
import java.security.KeyStore;
import java.security.PrivateKey;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

Expand Down Expand Up @@ -75,7 +76,7 @@ void updateKeyStoreReadKeyPassword() throws Exception {
KeyStore keyStore = keyStoreService.createKeyStore(keyStoreAuth, config);
KeyStoreAuth newKeystoreAuth = new KeyStoreAuth(new ReadStorePassword("newstorepass"), new ReadKeyPassword("newkeypass".toCharArray()));
KeyStore updatedKeyStore = keyStoreService.updateKeyStoreReadKeyPassword(keyStore, keyStoreAuth, newKeystoreAuth);
Assertions.assertEquals("newkeypass", newKeystoreAuth.getReadKeyPassword().getValue());
Assertions.assertTrue(Arrays.equals("newkeypass".toCharArray(), newKeystoreAuth.getReadKeyPassword().getValue()));
}
@Test
void addPasswordBasedSecretKey() {
Expand Down

0 comments on commit d3ced01

Please sign in to comment.