Class KeyManager
- java.lang.Object
-
- io.mosip.authentication.common.service.integration.KeyManager
-
@Component public class KeyManager extends Object
The Class KeyManager is used to decipher the request and returning the decipher request to the filter to do further authentication.- Author:
- Sanjay Murali, Manoj SP
-
-
Constructor Summary
Constructors Constructor Description KeyManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringencryptData(Map<String,Object> responseBody, com.fasterxml.jackson.databind.ObjectMapper mapper)Encrypt data.StringkernelDecrypt(String thumbprint, byte[] encryptedSessionKey, byte[] encryptedData, String refId, String aad, String salt, Boolean isThumbprintEnabled)Kernel decrypt.StringkernelDecryptAndDecode(String thumbprint, byte[] encryptedSessionKey, byte[] encryptedData, String refId, Boolean isThumbprintEnabled)Kernel decrypt and decode.Map<String,Object>requestData(Map<String,Object> requestBody, com.fasterxml.jackson.databind.ObjectMapper mapper, String refId, String thumbprint, Boolean isThumbprintEnabled, io.mosip.kernel.core.function.ConsumerWithThrowable<String,IdAuthenticationAppException> dataValidator)requestData method used to decipher the request blockRequestDTOpresent in AuthRequestDTOAuthRequestDTO.StringsignResponse(String data)This method is used to digitally sign the response.
-
-
-
Method Detail
-
requestData
public Map<String,Object> requestData(Map<String,Object> requestBody, com.fasterxml.jackson.databind.ObjectMapper mapper, String refId, String thumbprint, Boolean isThumbprintEnabled, io.mosip.kernel.core.function.ConsumerWithThrowable<String,IdAuthenticationAppException> dataValidator) throws IdAuthenticationAppException
requestData method used to decipher the request blockRequestDTOpresent in AuthRequestDTOAuthRequestDTO.- Parameters:
requestBody- the request bodymapper- the mapperrefId- the ref idthumbprint- the thumbprintisThumbprintEnabled- the is thumbprint enableddataValidator- the data validator- Returns:
- the map
- Throws:
IdAuthenticationAppException- the id authentication app exception
-
kernelDecryptAndDecode
public String kernelDecryptAndDecode(String thumbprint, byte[] encryptedSessionKey, byte[] encryptedData, String refId, Boolean isThumbprintEnabled) throws IdAuthenticationAppException
Kernel decrypt and decode.- Parameters:
thumbprint- the thumbprintencryptedSessionKey- the encrypted session keyencryptedData- the encrypted datarefId- the ref idisThumbprintEnabled- the is thumbprint enabled- Returns:
- the string
- Throws:
IdAuthenticationAppException- the id authentication app exception
-
kernelDecrypt
public String kernelDecrypt(String thumbprint, byte[] encryptedSessionKey, byte[] encryptedData, String refId, String aad, String salt, Boolean isThumbprintEnabled) throws IdAuthenticationAppException
Kernel decrypt.- Parameters:
thumbprint- the thumbprintencryptedSessionKey- the encrypted session keyencryptedData- the encrypted datarefId- the ref idaad- the aadsalt- the saltisThumbprintEnabled- the is thumbprint enabled- Returns:
- the string
- Throws:
IdAuthenticationAppException- the id authentication app exception
-
encryptData
public String encryptData(Map<String,Object> responseBody, com.fasterxml.jackson.databind.ObjectMapper mapper) throws IdAuthenticationAppException
Encrypt data.- Parameters:
responseBody- the response bodymapper- the mapper- Returns:
- the string
- Throws:
IdAuthenticationAppException- the id authentication app exception
-
signResponse
public String signResponse(String data) throws IdAuthenticationAppException
This method is used to digitally sign the response.- Parameters:
data- the response got after authentication which to be signed- Returns:
- the signed response string
- Throws:
IdAuthenticationAppException- the id authentication app exception
-
-