-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable some previously disabled longer running tests (#974)
* Enable integration tests * jnacl and kalium (only run when corresponding profile is active) * jnacl encrypt and decrypt * Remove CoreIT, enable jersey server ITs, undo grpc-related exclusions
- Loading branch information
Showing
7 changed files
with
138 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 52 additions & 46 deletions
98
config/src/test/java/com/quorum/tessera/config/keys/KeyEncryptorIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,52 @@ | ||
//package com.quorum.tessera.keyenc; | ||
// | ||
//import Argon2; | ||
//import Key; | ||
//import NaclFacade; | ||
//import NaclFacadeFactory; | ||
//import org.assertj.core.api.Assertions; | ||
//import org.junit.Before; | ||
//import org.junit.Test; | ||
// | ||
//import javax.json.JsonObject; | ||
//import java.util.Base64; | ||
// | ||
//public class KeyEncryptorIT { | ||
// | ||
// private static final String pkeyBase64 = "kwMSmHpIhCFFoOCyGkHkJyfLVxsa9Mj3Y23sFYRLwLM="; | ||
// | ||
// private static final String password = "PASS_WORD"; | ||
// | ||
// private KeyEncryptor keyEncryptor; | ||
// | ||
// private Key privateKey; | ||
// | ||
// @Before | ||
// public void init() { | ||
// | ||
// final NaclFacade nacl = NaclFacadeFactory.newFactory().create(); | ||
// final Argon2 argon2 = Argon2.create(); | ||
// | ||
// this.privateKey = new Key(Base64.getDecoder().decode(pkeyBase64)); | ||
// | ||
// this.keyEncryptor = new KeyEncryptorImpl(argon2, nacl); | ||
// } | ||
// | ||
// @Test | ||
// public void encryptAndDecryptOnKeyIsSuccessful() { | ||
// | ||
// final JsonObject jsonObject = keyEncryptor.encryptPrivateKey(privateKey, password); | ||
// | ||
// final Key decryptedKey = keyEncryptor.decryptPrivateKey(jsonObject, password); | ||
// | ||
// Assertions.assertThat(decryptedKey).isEqualTo(privateKey); | ||
// | ||
// } | ||
// | ||
//} | ||
package com.quorum.tessera.config.keys; | ||
|
||
import com.quorum.tessera.config.ArgonOptions; | ||
import com.quorum.tessera.config.EncryptorConfig; | ||
import com.quorum.tessera.config.EncryptorType; | ||
import com.quorum.tessera.config.PrivateKeyData; | ||
import com.quorum.tessera.encryption.PrivateKey; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.util.Base64; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public class KeyEncryptorIT { | ||
|
||
private static final Logger LOGGER = LoggerFactory.getLogger(KeyEncryptorIT.class); | ||
|
||
private static final String pkeyBase64 = "kwMSmHpIhCFFoOCyGkHkJyfLVxsa9Mj3Y23sFYRLwLM="; | ||
|
||
private static final String password = "PASS_WORD"; | ||
|
||
private KeyEncryptor keyEncryptor; | ||
|
||
private PrivateKey privateKey; | ||
|
||
@Before | ||
public void init() { | ||
this.privateKey = PrivateKey.from(Base64.getDecoder().decode(pkeyBase64)); | ||
|
||
this.keyEncryptor = | ||
KeyEncryptorFactory.newFactory() | ||
.create( | ||
new EncryptorConfig() { | ||
{ | ||
setType(EncryptorType.NACL); | ||
} | ||
}); | ||
} | ||
|
||
@Test | ||
public void encryptAndDecryptOnKeyIsSuccessful() { | ||
ArgonOptions argonOptions = new ArgonOptions("i", 10, 1048576, 4); | ||
|
||
final PrivateKeyData privateKeyData = keyEncryptor.encryptPrivateKey(privateKey, password, argonOptions); | ||
final PrivateKey decryptedKey = keyEncryptor.decryptPrivateKey(privateKeyData, password); | ||
|
||
assertThat(decryptedKey).isEqualTo(privateKey); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 0 additions & 38 deletions
38
tessera-core/src/test/java/com/quorum/tessera/core/CoreIT.java
This file was deleted.
Oops, something went wrong.