Class AndroidClientCryptoServiceImpl
- java.lang.Object
-
- io.mosip.kernel.clientcrypto.service.impl.AndroidClientCryptoServiceImpl
-
- All Implemented Interfaces:
ClientCryptoService
public class AndroidClientCryptoServiceImpl extends Object implements ClientCryptoService
-
-
Constructor Summary
Constructors Constructor Description AndroidClientCryptoServiceImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]asymmetricDecrypt(@javax.validation.constraints.NotNull byte[] cipher)Decrypts provided cipher textbyte[]asymmetricEncrypt(@javax.validation.constraints.NotNull byte[] plainData)Encrypts the input datastatic byte[]asymmetricEncrypt(byte[] public_key, byte[] dataToEncrypt)voidcloseSecurityInstance()Closes underlying security implementationbyte[]getEncryptionPublicPart()byte[]getSigningPublicPart()booleanisTPMInstance()byte[]signData(@javax.validation.constraints.NotNull byte[] dataToSign)Signs the input data by private key providedbooleanvalidateSignature(@javax.validation.constraints.NotNull byte[] signature, @javax.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)
-
-
-
Method Detail
-
signData
public byte[] signData(@NotNull @javax.validation.constraints.NotNull byte[] dataToSign) throws ClientCryptoExceptionDescription 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 @javax.validation.constraints.NotNull byte[] signature, @NotNull @javax.validation.constraints.NotNull byte[] actualData) throws ClientCryptoExceptionDescription 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 @javax.validation.constraints.NotNull byte[] plainData) throws ClientCryptoExceptionDescription 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 @javax.validation.constraints.NotNull byte[] cipher) throws ClientCryptoExceptionDescription 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
public void closeSecurityInstance() throws ClientCryptoExceptionDescription 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
-
-