Class CryptomanagerUtils
- java.lang.Object
-
- io.mosip.kernel.cryptomanager.util.CryptomanagerUtils
-
@RefreshScope @Component public class CryptomanagerUtils extends Object
Util class for this project.- Since:
- 1.0.0
- Author:
- Urvil Joshi, Manoj SP
-
-
Constructor Summary
Constructors Constructor Description CryptomanagerUtils()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]concatCertThumbprint(byte[] certThumbprint, byte[] encryptedKey)CertificategetCertificate(CryptomanagerRequestDto cryptomanagerRequestDto)Calls Key-Manager-Service to get public key of an application.byte[]getCertificateThumbprint(Certificate cert)SecretKeygetDecryptedSymmetricKey(CryptomanagerRequestDto cryptomanagerRequestDto)Calls Key-Manager-Service to decrypt symmetric key.byte[]hexDecode(String hexData)hex decode string to byte arraybooleanisValidSalt(String salt)Function to check is salt is valid.static StringnullOrTrim(String parameter)Change Parameter form to trim if not null.LocalDateTimeparseToLocalDateTime(String dateTime)Parse a date string of pattern UTC_DATETIME_PATTERN intoLocalDateTime.
-
-
-
Method Detail
-
getCertificate
public Certificate getCertificate(CryptomanagerRequestDto cryptomanagerRequestDto)
Calls Key-Manager-Service to get public key of an application.- Parameters:
cryptomanagerRequestDto-CryptomanagerRequestDtoinstance- Returns:
Certificatereturned by Key Manager Service
-
getDecryptedSymmetricKey
public SecretKey getDecryptedSymmetricKey(CryptomanagerRequestDto cryptomanagerRequestDto)
Calls Key-Manager-Service to decrypt symmetric key.- Parameters:
cryptomanagerRequestDto-CryptomanagerRequestDtoinstance- Returns:
- Decrypted
SecretKeyfrom Key Manager Service
-
nullOrTrim
public static String nullOrTrim(String parameter)
Change Parameter form to trim if not null.- Parameters:
parameter- parameter- Returns:
- null if null;else trimmed string
-
isValidSalt
public boolean isValidSalt(String salt)
Function to check is salt is valid.- Parameters:
salt- salt- Returns:
- true if salt is valid, else false
-
parseToLocalDateTime
public LocalDateTime parseToLocalDateTime(String dateTime)
Parse a date string of pattern UTC_DATETIME_PATTERN intoLocalDateTime.- Parameters:
dateTimeof- typeStringof pattern UTC_DATETIME_PATTERN- Returns:
- a
LocalDateTimeof given pattern
-
hexDecode
public byte[] hexDecode(String hexData)
hex decode string to byte array- Parameters:
hexData- typeString- Returns:
- a
byteof given data
-
getCertificateThumbprint
public byte[] getCertificateThumbprint(Certificate cert)
-
concatCertThumbprint
public byte[] concatCertThumbprint(byte[] certThumbprint, byte[] encryptedKey)
-
-