use of tech.pegasys.signers.bls.keystore.model.KdfParam in project signers by ConsenSys.
the class KeyStoreTest method encryptUsingSCryptAndSaveKeyStore.
@Test
void encryptUsingSCryptAndSaveKeyStore(@TempDir final Path tempDir) throws IOException {
final KdfParam kdfParam = new SCryptParam(DKLEN, MEMORY_CPU_COST, PARALLELIZATION, BLOCKSIZE, SALT);
encryptSaveAndReloadKeyStore(tempDir, kdfParam);
}
use of tech.pegasys.signers.bls.keystore.model.KdfParam in project signers by ConsenSys.
the class KeyStoreTest method encryptUsingPBKDF2AndSaveKeyStore.
@Test
void encryptUsingPBKDF2AndSaveKeyStore(@TempDir final Path tempDir) throws IOException {
final KdfParam kdfParam = new Pbkdf2Param(DKLEN, ITERATIVE_COUNT, Pbkdf2PseudoRandomFunction.HMAC_SHA256, SALT);
encryptSaveAndReloadKeyStore(tempDir, kdfParam);
}
use of tech.pegasys.signers.bls.keystore.model.KdfParam in project web3signer by ConsenSys.
the class BlsArtifactSignerFactoryTest method createKeyStoreFile.
private static void createKeyStoreFile(final Path keyStoreFilePath, final String password, final Bytes privateKey, final Bytes publicKey) {
final KdfParam kdfParam = new SCryptParam(32, KEYSTORE_SALT);
final Cipher cipher = new Cipher(CipherFunction.AES_128_CTR, Bytes.fromHexString("e0f20a27d160f7cc92764579390e881a"));
final KeyStoreData keyStoreData = KeyStore.encrypt(privateKey, publicKey, password, "", kdfParam, cipher);
try {
KeyStoreLoader.saveToFile(keyStoreFilePath, keyStoreData);
} catch (IOException e) {
fail("Unable to create keystore file", e);
}
}
use of tech.pegasys.signers.bls.keystore.model.KdfParam in project web3signer by ConsenSys.
the class MetadataFileHelpers method createKeyStoreFile.
private void createKeyStoreFile(final Path keyStoreFilePath, final String password, final Bytes privateKey, final Bytes publicKey, final KdfFunction kdfFunctionType) {
final KdfParam kdfParam = kdfFunctionType == KdfFunction.SCRYPT ? new SCryptParam(32, SALT) : new Pbkdf2Param(32, 262144, HMAC_SHA256, SALT);
final Cipher cipher = new Cipher(CipherFunction.AES_128_CTR, IV);
final KeyStoreData keyStoreData = KeyStore.encrypt(privateKey, publicKey, password, "m/12381/3600/0/0/0", kdfParam, cipher);
try {
KeyStoreLoader.saveToFile(keyStoreFilePath, keyStoreData);
} catch (IOException e) {
fail("Unable to create keystore file", e);
}
}
use of tech.pegasys.signers.bls.keystore.model.KdfParam in project web3signer by ConsenSys.
the class BlsArtifactSignerFactoryTest method createKeyStoreFile.
private static void createKeyStoreFile(final Path keyStoreFilePath, final String password, final Bytes privateKey, final Bytes publicKey) {
final KdfParam kdfParam = new SCryptParam(32, KEYSTORE_SALT);
final Cipher cipher = new Cipher(CipherFunction.AES_128_CTR, Bytes.fromHexString("e0f20a27d160f7cc92764579390e881a"));
final KeyStoreData keyStoreData = KeyStore.encrypt(privateKey, publicKey, password, "", kdfParam, cipher);
try {
KeyStoreLoader.saveToFile(keyStoreFilePath, keyStoreData);
} catch (IOException e) {
fail("Unable to create keystore file", e);
}
}
Aggregations