Class KeymanagerDBHelper
- java.lang.Object
-
- io.mosip.kernel.keymanagerservice.helper.KeymanagerDBHelper
-
@Component public class KeymanagerDBHelper extends Object
DB Helper class for Keymanager- Since:
- 1.1.2
- Author:
- Mahammed Taheer
-
-
Constructor Summary
Constructors Constructor Description KeymanagerDBHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LocalDateTimegetExpiryPolicy(String applicationId, LocalDateTime timeStamp, List<KeyAlias> keyAlias)Function to get expiry datetime using keypolicy table.Map<String,List<KeyAlias>>getKeyAliases(String applicationId, String referenceId, LocalDateTime timeStamp)Function to get keyalias from keyalias tableOptional<KeyPolicy>getKeyPolicy(String applicationId)Function to fetch KeyPolicy from DB.Optional<KeyStore>getKeyStoreFromDB(String keyAlias)Function to fetch Keystore from DB.voidstoreKeyInAlias(String applicationId, LocalDateTime timeStamp, String referenceId, String alias, LocalDateTime expiryDateTime)Function to store key in keyalias tablevoidstoreKeyInDBStore(String alias, String masterAlias, String certificateData, String encryptedPrivateKey)Function to store key in DB store
-
-
-
Method Detail
-
storeKeyInAlias
public void storeKeyInAlias(String applicationId, LocalDateTime timeStamp, String referenceId, String alias, LocalDateTime expiryDateTime)
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- masterAliaspublicKey- publicKeyencryptedPrivateKey- 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
public Optional<KeyStore> getKeyStoreFromDB(String keyAlias)
Function to fetch Keystore from DB.- Parameters:
keyAlias- alias of the key.- Returns:
- KeyStore
-
-