Package com.couchbase.client.encryption
Interface CryptoProvider
public interface CryptoProvider
CryptoProvider interface for cryptographic algorithm provider implementations.
- Since:
- 0.1.0
- Author:
- Subhashni Balakrishnan
-
Method Summary
Modifier and Type Method Description booleancheckAlgorithmNameMatch(String name)Check if the algorithm name is a matchbyte[]decrypt(byte[] encrypted)Decrypts the given data.byte[]encrypt(byte[] data)Encrypts the given data.intgetIVSize()Get the initialization vector size that prepended to the encrypted bytesKeyStoreProvidergetKeyStoreProvider()Get the key store provider set for the crypto provider use.StringgetProviderAlgorithmName()Get the crypto provider algorithm nameStringgetProviderName()Deprecated.byte[]getSignature(byte[] message)Get the signature for the integrity check using the key given.voidsetAlias(String alias)Set the alias name on the providervoidsetKeyStoreProvider(KeyStoreProvider provider)Set the key store provider for the crypto provider to get keys from.booleanverifySignature(byte[] message, byte[] signature)verify the signature for the integrity check.
-
Method Details
-
getKeyStoreProvider
KeyStoreProvider getKeyStoreProvider()Get the key store provider set for the crypto provider use.- Returns:
- Key store provider set
-
setKeyStoreProvider
Set the key store provider for the crypto provider to get keys from.- Parameters:
provider- Key store provider
-
encrypt
Encrypts the given data. Will throw exceptions if the key store and key name are not set.- Parameters:
data- Data to be encrypted- Returns:
- encrypted bytes
- Throws:
Exception- on failure
-
getIVSize
int getIVSize()Get the initialization vector size that prepended to the encrypted bytes- Returns:
- iv size
-
decrypt
Decrypts the given data. Will throw exceptions if the key store and key name are not set.- Parameters:
encrypted- Encrypted data- Returns:
- decrypted bytes
- Throws:
Exception- on failure
-
getSignature
Get the signature for the integrity check using the key given.- Parameters:
message- The message to check for correctness- Returns:
- signature
- Throws:
Exception- on failure
-
verifySignature
verify the signature for the integrity check.- Parameters:
message- The message to check for correctnesssignature- Signature used for message- Returns:
- True if success
- Throws:
Exception- on failure
-
getProviderAlgorithmName
String getProviderAlgorithmName()Get the crypto provider algorithm name- Returns:
- provider algorithm name
-
getProviderName
Deprecated.Get the crypto provider algorithm name, not the alias used for registering- Returns:
- provider algorithm name
-
checkAlgorithmNameMatch
Check if the algorithm name is a match- Parameters:
name- name to check- Returns:
- true if there is a match
-
setAlias
Set the alias name on the provider- Parameters:
alias- alias for the provider
-