Search in sources :

Example 21 with KeyPair

use of com.quorum.tessera.encryption.KeyPair in project tessera by ConsenSys.

the class ConfigGenerator method keyLookup.

private static Map<Integer, SortedMap<String, String>> keyLookup(EncryptorType encryptorType) {
    final Encryptor encryptor = transaction.utils.Utils.getEncryptor(encryptorType);
    return new HashMap<Integer, SortedMap<String, String>>() {

        {
            put(1, new TreeMap<String, String>() {

                KeyPair pair = encryptor.generateNewKeys();

                {
                    put(pair.getPublicKey().encodeToBase64(), pair.getPrivateKey().encodeToBase64());
                }
            });
            put(2, new TreeMap<String, String>() {

                KeyPair pair = encryptor.generateNewKeys();

                {
                    put(pair.getPublicKey().encodeToBase64(), pair.getPrivateKey().encodeToBase64());
                }
            });
            put(3, new TreeMap<String, String>() {

                KeyPair pair = encryptor.generateNewKeys();

                KeyPair pair2 = encryptor.generateNewKeys();

                {
                    put(pair.getPublicKey().encodeToBase64(), pair.getPrivateKey().encodeToBase64());
                    put(pair2.getPublicKey().encodeToBase64(), pair2.getPrivateKey().encodeToBase64());
                }
            });
            put(4, new TreeMap<String, String>() {

                KeyPair pair = encryptor.generateNewKeys();

                {
                    put(pair.getPublicKey().encodeToBase64(), pair.getPrivateKey().encodeToBase64());
                }
            });
        }
    };
}
Also used : KeyPair(com.quorum.tessera.encryption.KeyPair) Encryptor(com.quorum.tessera.encryption.Encryptor)

Aggregations

KeyPair (com.quorum.tessera.encryption.KeyPair)21 Test (org.junit.Test)11 KeyVaultService (com.quorum.tessera.key.vault.KeyVaultService)7 Encryptor (com.quorum.tessera.encryption.Encryptor)5 KeyVaultServiceFactory (com.quorum.tessera.key.vault.KeyVaultServiceFactory)4 Before (org.junit.Before)4 Config (com.quorum.tessera.config.Config)3 AWSKeyPair (com.quorum.tessera.config.keypairs.AWSKeyPair)3 AzureVaultKeyPair (com.quorum.tessera.config.keypairs.AzureVaultKeyPair)3 HashicorpVaultKeyPair (com.quorum.tessera.config.keypairs.HashicorpVaultKeyPair)3 EnvironmentVariableProvider (com.quorum.tessera.config.util.EnvironmentVariableProvider)3 Path (java.nio.file.Path)3 FilesystemKeyPair (com.quorum.tessera.config.keypairs.FilesystemKeyPair)2 UnsupportedCharsetException (java.nio.charset.UnsupportedCharsetException)2 KeyData (com.quorum.tessera.config.KeyData)1 KeyDataConfig (com.quorum.tessera.config.KeyDataConfig)1 PrivateKeyData (com.quorum.tessera.config.PrivateKeyData)1 ConfigKeyPair (com.quorum.tessera.config.keypairs.ConfigKeyPair)1 KeyEncryptor (com.quorum.tessera.config.keys.KeyEncryptor)1 SharedKey (com.quorum.tessera.encryption.SharedKey)1