Package com.couchbase.client.encryption
Interface CryptoProvider
-
public interface CryptoProviderCryptoProvider interface for cryptographic algorithm provider implementations.- Since:
- 0.1.0
- Author:
- Subhashni Balakrishnan
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods 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 Detail
-
getKeyStoreProvider
KeyStoreProvider getKeyStoreProvider()
Get the key store provider set for the crypto provider use.- Returns:
- Key store provider set
-
setKeyStoreProvider
void setKeyStoreProvider(KeyStoreProvider provider)
Set the key store provider for the crypto provider to get keys from.- Parameters:
provider- Key store provider
-
encrypt
byte[] encrypt(byte[] data) throws ExceptionEncrypts 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
byte[] decrypt(byte[] encrypted) throws ExceptionDecrypts 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
byte[] getSignature(byte[] message) throws ExceptionGet 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
boolean verifySignature(byte[] message, byte[] signature) throws Exceptionverify 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 String getProviderName()
Deprecated.Get the crypto provider algorithm name, not the alias used for registering- Returns:
- provider algorithm name
-
checkAlgorithmNameMatch
boolean checkAlgorithmNameMatch(String name)
Check if the algorithm name is a match- Parameters:
name- name to check- Returns:
- true if there is a match
-
setAlias
void setAlias(String alias)
Set the alias name on the provider- Parameters:
alias- alias for the provider
-
-