Exporting a Security Object

Security Objects need to be marked as exportable for this operation, which means that EXPORT operation needs to be enabled in Key Operations of the Security Object.

C#

SobjectDescriptor soDescriptor = new SobjectDescriptor(
            Name: (<name of the key>);
KeyObject keyObject = securityObjectsApi.GetSecurityObjectValue (soDescriptor);
keyObject.Value // contains the key material

Go

keyName := "<name of the key>"
sobject, err := client.ExportSobject(ctx, sdkms.SobjectByName(keyName))

Java

SobjectDescriptor soDescriptor = new SobjectDescriptor()
            .name(<name of the key>);
KeyObject keyObject = securityObjectsApi.getSecurityObjectValue (soDescriptor);
keyObject.value // contains the key material

Python

api_instance = sdkms.v1.SecurityObjectsApi(api_client=client)
request = sdkms.v1.SobjectDescriptor(name='<name of the key>')
key = api_instance.get_security_object_value(request)
key.value #contains the key material

PHP

$api_instance = new SdkmsClient\Api\SecurityObjectsApi($client);
$request=array('name' => '<name of the key>');
$keyObject = api_instance->getSecurityObjectValueEx($request);
$keyObject.value // contains the key material

Javascript

var request = FortanixSdkmsRestApi.SobjectDescriptor.constructFromObject({"name": "<name of the key>"});
var exportCallback = function(error, data, response) {
    if (error) {
        console.error("Error: " + JSON.stringify(response));
    } else {
        data.value // contains the key material
    }
};
var sObjectsApi = new FortanixSdkmsRestApi.SecurityObjectsApi()
sObjectsApi.getSecurityObjectValueEx(request, exportCallback);

REST API using curl

curl <Endpoint URL>/crypto/v1/keys/export -H 'Authorization: Bearer YhXwwa-6C...ig5g' -d '{"name": "Key-Name"}'
Was this article helpful?
0 out of 0 found this helpful