Class AndroidClientCryptoServiceImpl
java.lang.Object
io.mosip.kernel.clientcrypto.service.impl.AndroidClientCryptoServiceImpl
- All Implemented Interfaces:
ClientCryptoService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]asymmetricDecrypt(@jakarta.validation.constraints.NotNull byte[] cipher) Decrypts provided cipher textbyte[]asymmetricEncrypt(@jakarta.validation.constraints.NotNull byte[] plainData) Encrypts the input datastatic byte[]asymmetricEncrypt(byte[] public_key, byte[] dataToEncrypt) voidCloses underlying security implementationbyte[]byte[]booleanbyte[]signData(@jakarta.validation.constraints.NotNull byte[] dataToSign) Signs the input data by private key providedbooleanvalidateSignature(@jakarta.validation.constraints.NotNull byte[] signature, @jakarta.validation.constraints.NotNull byte[] actualData) Validates the signed data against the actual data using the public part of underlying security modulestatic booleanvalidateSignature(byte[] public_key, byte[] signature, byte[] actualData)
-
Constructor Details
-
AndroidClientCryptoServiceImpl
public AndroidClientCryptoServiceImpl()
-
-
Method Details
-
signData
public byte[] signData(@NotNull @jakarta.validation.constraints.NotNull byte[] dataToSign) throws ClientCryptoException Description copied from interface:ClientCryptoServiceSigns the input data by private key provided- Specified by:
signDatain interfaceClientCryptoService- Parameters:
dataToSign- plain data to be signed- Returns:
- signature bytes
- Throws:
ClientCryptoException
-
validateSignature
public boolean validateSignature(@NotNull @jakarta.validation.constraints.NotNull byte[] signature, @NotNull @jakarta.validation.constraints.NotNull byte[] actualData) throws ClientCryptoException Description copied from interface:ClientCryptoServiceValidates the signed data against the actual data using the public part of underlying security module- Specified by:
validateSignaturein interfaceClientCryptoService- Parameters:
signature- - signature to verify againstactualData- - plain data- Returns:
- true if successful signature verification
- Throws:
ClientCryptoException
-
asymmetricEncrypt
public byte[] asymmetricEncrypt(@NotNull @jakarta.validation.constraints.NotNull byte[] plainData) throws ClientCryptoException Description copied from interface:ClientCryptoServiceEncrypts the input data- Specified by:
asymmetricEncryptin interfaceClientCryptoService- Parameters:
plainData- - plain data to encrypt- Returns:
- encrypted data
- Throws:
ClientCryptoException
-
asymmetricDecrypt
public byte[] asymmetricDecrypt(@NotNull @jakarta.validation.constraints.NotNull byte[] cipher) throws ClientCryptoException Description copied from interface:ClientCryptoServiceDecrypts provided cipher text- Specified by:
asymmetricDecryptin interfaceClientCryptoService- Parameters:
cipher- - encrypted data- Returns:
- plain data
- Throws:
ClientCryptoException
-
getSigningPublicPart
public byte[] getSigningPublicPart()- Specified by:
getSigningPublicPartin interfaceClientCryptoService- Returns:
- public key as byte array
-
closeSecurityInstance
Description copied from interface:ClientCryptoServiceCloses underlying security implementation- Specified by:
closeSecurityInstancein interfaceClientCryptoService- Throws:
ClientCryptoException
-
isTPMInstance
public boolean isTPMInstance()- Specified by:
isTPMInstancein interfaceClientCryptoService- Returns:
- true if the implementation was specific to TPM
-
getEncryptionPublicPart
public byte[] getEncryptionPublicPart()- Specified by:
getEncryptionPublicPartin interfaceClientCryptoService- Returns:
- public key as byte array
-
validateSignature
public static boolean validateSignature(byte[] public_key, byte[] signature, byte[] actualData) throws ClientCryptoException - Throws:
ClientCryptoException
-
asymmetricEncrypt
public static byte[] asymmetricEncrypt(byte[] public_key, byte[] dataToEncrypt) throws ClientCryptoException - Throws:
ClientCryptoException
-