--- title: "Deleting a Security Object" slug: "dsm-example-code-deleting-a-security-object" updated: 2024-12-10T17:32:44Z published: 2024-12-10T17:32:44Z canonical: "support.fortanix.com/dsm-example-code-deleting-a-security-object" --- > ## Documentation Index > Fetch the complete documentation index at: https://support.fortanix.com/llms.txt > Use this file to discover all available pages before exploring further. # Deleting a Security Object - [C++](/docs/dsm-example-code-deleting-a-security-object#tabs-1) - [C#](/docs/dsm-example-code-deleting-a-security-object#tabs-2) - [Go](/docs/dsm-example-code-deleting-a-security-object#tabs-3) - [Java](/docs/dsm-example-code-deleting-a-security-object#tabs-4) - [Python](/docs/dsm-example-code-deleting-a-security-object#tabs-5) - [Javascript](/docs/dsm-example-code-deleting-a-security-object#tabs-6) - [REST API using curl](/docs/dsm-example-code-deleting-a-security-object#tabs-7) ### C++ ```bash CK_RV delete_key(CK_FUNCTION_LIST_PTR p11, CK_SESSION_HANDLE hSession, CK_OBJECT_HANDLE hKey) { return p11->C_DestroyObject(hSession, hKey); } ``` ### C# ```bash KeyObject keyObject = securityObjectsApi.DeleteSecurityObject (); ``` ### Go ```bash keyId := "" err := client. DeleteSobject(ctx, *keyId) ``` ### Java ```bash KeyObject keyObject = securityObjectsApi.deleteSecurityObject(); ``` ### Python ```bash api_instance = sdkms.v1.SecurityObjectsApi(api_client=client) api_instance.delete_security_object_value() ``` ### Javascript ```bash var deleteKeyCallback = function(error, data, response) {    if (error) {        console.error("Error: " + JSON.stringify(response));    } else {        console.log('security object deleted successfully.');    } }; var securityObjectApi = new FortanixSdkmsRestApi.SecurityObjectsApi() securityObjectApi.deleteSecurityObject(kid, deleteKeyCallback); ``` ### REST API using curl ```bash curl -X DELETE /crypto/v1/keys/ -H 'Authorization: Bearer YhXwwa-6C...ig5g' ``` ## Related - [Exporting a Security Object](/dsm-example-code-exporting-a-security-object.md) - [What is the lifecycle of a Fortanix DSM SaaS Trial Account?](/what-is-the-lifecycle-of-a-fortanix-dsm-saas-trial-account.md) - [Deleting Security Objects](/dsm-deleting-security-objects.md)