Class SdkmsKeyService
- java.lang.Object
-
- com.fortanix.sdkms.jce.provider.service.SdkmsKeyService
-
public final class SdkmsKeyService extends Object
Encapsulate Key existence check and other Key related API
-
-
Constructor Summary
Constructors Constructor Description SdkmsKeyService()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.fortanix.sdkms.v1.model.KeyObjectagreeKey(com.fortanix.sdkms.v1.model.AgreeKeyRequest agreeKeyRequest)Creates key agreement between aa public and private key combinationstatic voiddeleteKey(String keyId)Deletes a given keystatic ECParameterSpecgetECPrivateKeyParams(com.fortanix.sdkms.v1.model.KeyObject keyObject)static com.fortanix.sdkms.v1.model.SobjectDescriptorgetKeyDescriptor(com.fortanix.sdkms.v1.model.KeyObject keyObject)static KeygetKeyFromKeyObject(com.fortanix.sdkms.v1.model.KeyObject keyObject, boolean isPublic)Gets a new instance of SDKMSKey from the KeyObject instance.static com.fortanix.sdkms.v1.model.KeyObjectgetKeyObject(com.fortanix.sdkms.v1.model.SobjectDescriptor descriptor)Look-up key in SDKMS and raise error if not found.static List<com.fortanix.sdkms.v1.model.KeyObject>getKeys(String name, String groupId, String creator)Get all keys from sdkms.static byte[]getKeyValue(com.fortanix.sdkms.v1.model.SobjectDescriptor descriptor)retrieve secret of key from sdkms.static byte[]getKeyValue(String keyId)retrieve secret of key from sdkmsstatic RSAPublicKeygetRSAPublicKey(com.fortanix.sdkms.v1.model.KeyObject keyObject)static com.fortanix.sdkms.v1.model.KeyObjectgetSecurityObjectByName(String name)Get an SDKMS key with a given namestatic com.fortanix.sdkms.v1.model.KeyObjectpersistKey(Key key, String name, Map<String,String> metaData)update the key name and make persistantstatic com.fortanix.sdkms.v1.model.KeyObjecttoKeyObject(Key key)static com.fortanix.sdkms.v1.model.ObjectTypetoSDKMSAlgorithm(String jceAlgorithm)This method returns the Algorithm enum supported by SDKMSstatic com.fortanix.sdkms.v1.model.KeyObjectupdateKey(com.fortanix.sdkms.v1.model.SobjectDescriptor key, String newName, Map<String,String> metaData)Update key to set name as per stored in keystore
-
-
-
Method Detail
-
toKeyObject
public static com.fortanix.sdkms.v1.model.KeyObject toKeyObject(Key key) throws InvalidKeyException
- Throws:
InvalidKeyException
-
getKeyObject
public static com.fortanix.sdkms.v1.model.KeyObject getKeyObject(com.fortanix.sdkms.v1.model.SobjectDescriptor descriptor)
Look-up key in SDKMS and raise error if not found.- Parameters:
descriptor-SobjectDescriptor
-
toSDKMSAlgorithm
public static com.fortanix.sdkms.v1.model.ObjectType toSDKMSAlgorithm(String jceAlgorithm)
This method returns the Algorithm enum supported by SDKMS- Parameters:
jceAlgorithm- JCE standard algorithm name Possible values are: RSA DSA DESede TripleDES AES- Returns:
-
getKeys
public static List<com.fortanix.sdkms.v1.model.KeyObject> getKeys(String name, String groupId, String creator)
Get all keys from sdkms. Used to get all alias in keystore.- Parameters:
name-groupId-creator-- Returns:
-
deleteKey
public static void deleteKey(String keyId)
Deletes a given key- Parameters:
keyId-
-
updateKey
public static com.fortanix.sdkms.v1.model.KeyObject updateKey(com.fortanix.sdkms.v1.model.SobjectDescriptor key, String newName, Map<String,String> metaData)Update key to set name as per stored in keystore- Parameters:
keyId-name-metaData-- Returns:
-
persistKey
public static com.fortanix.sdkms.v1.model.KeyObject persistKey(Key key, String name, Map<String,String> metaData)
update the key name and make persistant- Parameters:
key-name-metaData-- Returns:
-
agreeKey
public static com.fortanix.sdkms.v1.model.KeyObject agreeKey(com.fortanix.sdkms.v1.model.AgreeKeyRequest agreeKeyRequest) throws InvalidKeyExceptionCreates key agreement between aa public and private key combination- Parameters:
agreeKeyRequest-- Returns:
- KeyObject
- Throws:
InvalidKeyException
-
getKeyValue
public static byte[] getKeyValue(String keyId)
retrieve secret of key from sdkms- Parameters:
keyId-- Returns:
- key value in bytes
-
getKeyValue
public static byte[] getKeyValue(com.fortanix.sdkms.v1.model.SobjectDescriptor descriptor)
retrieve secret of key from sdkms. .returns null on export failure- Parameters:
descriptor-- Returns:
- key value in bytes
-
getSecurityObjectByName
public static com.fortanix.sdkms.v1.model.KeyObject getSecurityObjectByName(String name)
Get an SDKMS key with a given name- Parameters:
name-- Returns:
-
getKeyFromKeyObject
public static Key getKeyFromKeyObject(com.fortanix.sdkms.v1.model.KeyObject keyObject, boolean isPublic) throws InvalidKeyException
Gets a new instance of SDKMSKey from the KeyObject instance. Essentially converting SDKKS Key to JCE type Keys.- Parameters:
keyObject-- Returns:
- Throws:
InvalidKeyException
-
getRSAPublicKey
public static RSAPublicKey getRSAPublicKey(com.fortanix.sdkms.v1.model.KeyObject keyObject) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException
-
getECPrivateKeyParams
public static ECParameterSpec getECPrivateKeyParams(com.fortanix.sdkms.v1.model.KeyObject keyObject) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException
-
getKeyDescriptor
public static com.fortanix.sdkms.v1.model.SobjectDescriptor getKeyDescriptor(com.fortanix.sdkms.v1.model.KeyObject keyObject)
-
-