Class KeymanagerDBHelper
java.lang.Object
io.mosip.kernel.keymanagerservice.helper.KeymanagerDBHelper
DB Helper class for Keymanager
- Since:
- 1.1.2
- Author:
- Mahammed Taheer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetExpiryPolicy(String applicationId, LocalDateTime timeStamp, List<KeyAlias> keyAlias) Function to get expiry datetime using keypolicy table.getKeyAlias(String certThumbprint, String appIdRefIdKey, String applicationId, String referenceId) getKeyAliases(String applicationId, String referenceId, LocalDateTime timeStamp) Function to get keyalias from keyalias tablegetKeyPolicy(String applicationId) Function to fetch KeyPolicy from DB.getKeyPolicyFromCache(String applicationId) getKeyStoreFromDB(String keyAlias) Function to fetch Keystore from DB.voidinit()voidstoreKeyInAlias(String applicationId, LocalDateTime timeStamp, String referenceId, String alias, LocalDateTime expiryDateTime, String certThumbprint, String uniqueIdentifier) Function to store key in keyalias tablevoidstoreKeyInDBStore(String alias, String masterAlias, String certificateData, String encryptedPrivateKey) Function to store key in DB store
-
Constructor Details
-
KeymanagerDBHelper
public KeymanagerDBHelper()
-
-
Method Details
-
init
@PostConstruct public void init() -
storeKeyInAlias
public void storeKeyInAlias(String applicationId, LocalDateTime timeStamp, String referenceId, String alias, LocalDateTime expiryDateTime, String certThumbprint, String uniqueIdentifier) Function to store key in keyalias table- Parameters:
applicationId- applicationIdtimeStamp- timeStampreferenceId- referenceIdalias- aliasexpiryDateTime- expiryDateTime
-
storeKeyInDBStore
public void storeKeyInDBStore(String alias, String masterAlias, String certificateData, String encryptedPrivateKey) Function to store key in DB store- Parameters:
alias- aliasmasterAlias- masterAliasencryptedPrivateKey- encryptedPrivateKey
-
getKeyAliases
public Map<String,List<KeyAlias>> getKeyAliases(String applicationId, String referenceId, LocalDateTime timeStamp) Function to get keyalias from keyalias table- Parameters:
applicationId- applicationIdreferenceId- referenceIdtimeStamp- timeStamp- Returns:
- a map containing a list of all keyalias matching applicationId and referenceId with key "keyAlias"; and a list of all keyalias with matching timestamp with key "currentKeyAlias"
-
getExpiryPolicy
public LocalDateTime getExpiryPolicy(String applicationId, LocalDateTime timeStamp, List<KeyAlias> keyAlias) Function to get expiry datetime using keypolicy table. If a overlapping key exists for same time interval, then expiry datetime of current key will be till generation datetime of overlapping key- Parameters:
applicationId- applicationIdtimeStamp- timeStampkeyAlias- keyAlias- Returns:
- expiry datetime
-
getKeyStoreFromDB
Function to fetch Keystore from DB.- Parameters:
keyAlias- alias of the key.- Returns:
- KeyStore
-
getKeyPolicy
Function to fetch KeyPolicy from DB.- Parameters:
applicationId- App Id of the key.- Returns:
- KeyPolicy
-
getKeyPolicyFromCache
-
getKeyAlias
-