Package io.mosip.kernel.crypto.jce.core
Class CryptoCore
- java.lang.Object
-
- io.mosip.kernel.crypto.jce.core.CryptoCore
-
- All Implemented Interfaces:
CryptoCoreSpec<byte[],byte[],SecretKey,PublicKey,PrivateKey,String>
@Component public class CryptoCore extends Object implements CryptoCoreSpec<byte[],byte[],SecretKey,PublicKey,PrivateKey,String>
This class provided Basic and Core Cryptographic functionalities . This class followsCryptoCoreSpecand implement all basic Cryptographic functions.- Since:
- 1.0.0
- Author:
- Urvil Joshi, Rajath
- See Also:
CryptoCoreSpec,PrivateKey,PublicKey,SecretKey,Cipher,GCMParameterSpec,SecureRandom
-
-
Constructor Summary
Constructors Constructor Description CryptoCore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]asymmetricDecrypt(PrivateKey privateKey, byte[] data)byte[]asymmetricDecrypt(PrivateKey privateKey, PublicKey publicKey, byte[] data)byte[]asymmetricEncrypt(PublicKey key, byte[] data)Stringhash(byte[] data, byte[] salt)voidinit()SecureRandomrandom()Stringsign(byte[] data, PrivateKey privateKey)Stringsign(byte[] data, PrivateKey privateKey, X509Certificate x509Certificate)byte[]symmetricDecrypt(SecretKey key, byte[] data, byte[] aad)byte[]symmetricDecrypt(SecretKey key, byte[] data, byte[] iv, byte[] aad)byte[]symmetricEncrypt(SecretKey key, byte[] data, byte[] aad)byte[]symmetricEncrypt(SecretKey key, byte[] data, byte[] iv, byte[] aad)booleanverifySignature(byte[] data, String sign, PublicKey publicKey)booleanverifySignature(String sign)
-
-
-
Method Detail
-
init
@PostConstruct public void init()
-
symmetricEncrypt
public byte[] symmetricEncrypt(SecretKey key, byte[] data, byte[] aad)
- Specified by:
symmetricEncryptin interfaceCryptoCoreSpec<byte[],byte[],SecretKey,PublicKey,PrivateKey,String>
-
symmetricEncrypt
public byte[] symmetricEncrypt(SecretKey key, byte[] data, byte[] iv, byte[] aad)
- Specified by:
symmetricEncryptin interfaceCryptoCoreSpec<byte[],byte[],SecretKey,PublicKey,PrivateKey,String>
-
symmetricDecrypt
public byte[] symmetricDecrypt(SecretKey key, byte[] data, byte[] aad)
- Specified by:
symmetricDecryptin interfaceCryptoCoreSpec<byte[],byte[],SecretKey,PublicKey,PrivateKey,String>
-
symmetricDecrypt
public byte[] symmetricDecrypt(SecretKey key, byte[] data, byte[] iv, byte[] aad)
- Specified by:
symmetricDecryptin interfaceCryptoCoreSpec<byte[],byte[],SecretKey,PublicKey,PrivateKey,String>
-
asymmetricEncrypt
public byte[] asymmetricEncrypt(PublicKey key, byte[] data)
- Specified by:
asymmetricEncryptin interfaceCryptoCoreSpec<byte[],byte[],SecretKey,PublicKey,PrivateKey,String>
-
asymmetricDecrypt
public byte[] asymmetricDecrypt(PrivateKey privateKey, byte[] data)
- Specified by:
asymmetricDecryptin interfaceCryptoCoreSpec<byte[],byte[],SecretKey,PublicKey,PrivateKey,String>
-
asymmetricDecrypt
public byte[] asymmetricDecrypt(PrivateKey privateKey, PublicKey publicKey, byte[] data)
- Specified by:
asymmetricDecryptin interfaceCryptoCoreSpec<byte[],byte[],SecretKey,PublicKey,PrivateKey,String>
-
hash
public String hash(byte[] data, byte[] salt)
- Specified by:
hashin interfaceCryptoCoreSpec<byte[],byte[],SecretKey,PublicKey,PrivateKey,String>
-
sign
public String sign(byte[] data, PrivateKey privateKey)
- Specified by:
signin interfaceCryptoCoreSpec<byte[],byte[],SecretKey,PublicKey,PrivateKey,String>
-
verifySignature
public boolean verifySignature(byte[] data, String sign, PublicKey publicKey)- Specified by:
verifySignaturein interfaceCryptoCoreSpec<byte[],byte[],SecretKey,PublicKey,PrivateKey,String>
-
random
public SecureRandom random()
- Specified by:
randomin interfaceCryptoCoreSpec<byte[],byte[],SecretKey,PublicKey,PrivateKey,String>
-
sign
public String sign(byte[] data, PrivateKey privateKey, X509Certificate x509Certificate)
- Specified by:
signin interfaceCryptoCoreSpec<byte[],byte[],SecretKey,PublicKey,PrivateKey,String>
-
verifySignature
public boolean verifySignature(String sign)
- Specified by:
verifySignaturein interfaceCryptoCoreSpec<byte[],byte[],SecretKey,PublicKey,PrivateKey,String>
-
-