Class SdkmsKeyService
- java.lang.Object
-
- com.fortanix.sdkms.jce.provider.service.SdkmsKeyService
-
public final class SdkmsKeyService extends java.lang.ObjectEncapsulate 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(java.lang.String keyId)Deletes a given keystatic java.security.spec.ECParameterSpecgetECPrivateKeyParams(com.fortanix.sdkms.v1.model.KeyObject keyObject)static com.fortanix.sdkms.v1.model.SobjectDescriptorgetKeyDescriptor(com.fortanix.sdkms.v1.model.KeyObject keyObject)static java.security.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 java.util.List<com.fortanix.sdkms.v1.model.KeyObject>getKeys(java.lang.String name, java.lang.String groupId, java.lang.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(java.lang.String keyId)retrieve secret of key from sdkmsstatic java.security.interfaces.RSAPublicKeygetRSAPublicKey(com.fortanix.sdkms.v1.model.KeyObject keyObject)static com.fortanix.sdkms.v1.model.KeyObjectgetSecurityObjectByName(java.lang.String name)Get an SDKMS key with a given namestatic com.fortanix.sdkms.v1.model.KeyObjectpersistKey(java.security.Key key, java.lang.String name, java.util.Map<java.lang.String,java.lang.String> metaData)update the key name and make persistantstatic com.fortanix.sdkms.v1.model.KeyObjecttoKeyObject(java.security.Key key)static com.fortanix.sdkms.v1.model.ObjectTypetoSDKMSAlgorithm(java.lang.String jceAlgorithm)This method returns the Algorithm enum supported by SDKMSstatic com.fortanix.sdkms.v1.model.KeyObjectupdateKey(com.fortanix.sdkms.v1.model.SobjectDescriptor key, java.lang.String newName, java.util.Map<java.lang.String,java.lang.String> metaData)Update key to set name as per stored in keystore
-
-
-
Method Detail
-
toKeyObject
public static com.fortanix.sdkms.v1.model.KeyObject toKeyObject(java.security.Key key) throws java.security.InvalidKeyException- Throws:
java.security.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(java.lang.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 java.util.List<com.fortanix.sdkms.v1.model.KeyObject> getKeys(java.lang.String name, java.lang.String groupId, java.lang.String creator)Get all keys from sdkms. Used to get all alias in keystore.- Parameters:
name-groupId-creator-- Returns:
-
deleteKey
public static void deleteKey(java.lang.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, java.lang.String newName, java.util.Map<java.lang.String,java.lang.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(java.security.Key key, java.lang.String name, java.util.Map<java.lang.String,java.lang.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 java.security.InvalidKeyExceptionCreates key agreement between aa public and private key combination- Parameters:
agreeKeyRequest-- Returns:
- KeyObject
- Throws:
java.security.InvalidKeyException
-
getKeyValue
public static byte[] getKeyValue(java.lang.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(java.lang.String name)
Get an SDKMS key with a given name- Parameters:
name-- Returns:
-
getKeyFromKeyObject
public static java.security.Key getKeyFromKeyObject(com.fortanix.sdkms.v1.model.KeyObject keyObject, boolean isPublic) throws java.security.InvalidKeyExceptionGets a new instance of SDKMSKey from the KeyObject instance. Essentially converting SDKKS Key to JCE type Keys.- Parameters:
keyObject-- Returns:
- Throws:
java.security.InvalidKeyException
-
getRSAPublicKey
public static java.security.interfaces.RSAPublicKey getRSAPublicKey(com.fortanix.sdkms.v1.model.KeyObject keyObject) throws java.security.NoSuchAlgorithmException, java.security.spec.InvalidKeySpecException, java.security.NoSuchProviderException- Throws:
java.security.NoSuchAlgorithmExceptionjava.security.spec.InvalidKeySpecExceptionjava.security.NoSuchProviderException
-
getECPrivateKeyParams
public static java.security.spec.ECParameterSpec getECPrivateKeyParams(com.fortanix.sdkms.v1.model.KeyObject keyObject) throws java.security.NoSuchAlgorithmException, java.security.spec.InvalidKeySpecException, java.security.NoSuchProviderException- Throws:
java.security.NoSuchAlgorithmExceptionjava.security.spec.InvalidKeySpecExceptionjava.security.NoSuchProviderException
-
getKeyDescriptor
public static com.fortanix.sdkms.v1.model.SobjectDescriptor getKeyDescriptor(com.fortanix.sdkms.v1.model.KeyObject keyObject)
-
-