Interface KeyCrypter
- 
- All Superinterfaces:
- java.io.Serializable
 - All Known Implementing Classes:
- KeyCrypterScrypt
 
 public interface KeyCrypter extends java.io.SerializableA KeyCrypter can be used to encrypt and decrypt a message. The sequence of events to encrypt and then decrypt a message are as follows: (1) Ask the user for a password. deriveKey() is then called to create an KeyParameter. This contains the AES key that will be used for encryption. (2) Encrypt the message using encrypt(), providing the message bytes and the KeyParameter from (1). This returns an EncryptedData which contains the encryptedPrivateKey bytes and an initialisation vector. (3) To decrypt an EncryptedData, repeat step (1) to get a KeyParameter, then call decrypt(). There can be different algorithms used for encryption/ decryption so the getUnderstoodEncryptionType is used to determine whether any given KeyCrypter can understand the type of encrypted data you have. 
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description byte[]decrypt(EncryptedData encryptedBytesToDecode, org.bouncycastle.crypto.params.KeyParameter aesKey)Decrypt the provided encrypted bytes, converting them into unencrypted bytes.org.bouncycastle.crypto.params.KeyParameterderiveKey(java.lang.CharSequence password)Create a KeyParameter (which typically contains an AES key)EncryptedDataencrypt(byte[] plainBytes, org.bouncycastle.crypto.params.KeyParameter aesKey)Encrypt the supplied bytes, converting them into ciphertext.Protos.Wallet.EncryptionTypegetUnderstoodEncryptionType()Return the EncryptionType enum value which denotes the type of encryption/ decryption that this KeyCrypter can understand.
 
- 
- 
- 
Method Detail- 
getUnderstoodEncryptionTypeProtos.Wallet.EncryptionType getUnderstoodEncryptionType() Return the EncryptionType enum value which denotes the type of encryption/ decryption that this KeyCrypter can understand.
 - 
deriveKeyorg.bouncycastle.crypto.params.KeyParameter deriveKey(java.lang.CharSequence password) throws KeyCrypterExceptionCreate a KeyParameter (which typically contains an AES key)- Parameters:
- password-
- Returns:
- KeyParameter The KeyParameter which typically contains the AES key to use for encrypting and decrypting
- Throws:
- KeyCrypterException
 
 - 
decryptbyte[] decrypt(EncryptedData encryptedBytesToDecode, org.bouncycastle.crypto.params.KeyParameter aesKey) throws KeyCrypterException Decrypt the provided encrypted bytes, converting them into unencrypted bytes.- Throws:
- KeyCrypterException- if decryption was unsuccessful.
 
 - 
encryptEncryptedData encrypt(byte[] plainBytes, org.bouncycastle.crypto.params.KeyParameter aesKey) throws KeyCrypterException Encrypt the supplied bytes, converting them into ciphertext.- Returns:
- encryptedPrivateKey An encryptedPrivateKey containing the encrypted bytes and an initialisation vector.
- Throws:
- KeyCrypterException- if encryption was unsuccessful
 
 
- 
 
-