The getSecurityObjects
API can also be used to lookup keys by name. The first parameter of this method restricts the returned value to only the Security-object with the requested name.
C#
SecurityObjectsApi sObjectApi = new SecurityObjectsApi();
List<KeyObject> sObjects = sObjectApi.GetSecurityObjects(name : "example-key");
KeyObject matched = sObjects[0];
Go
keyName := "example-key"
sobjectDescriptor := sdkms.SobjectDescriptor {
Name: &keyName,
}
key, err := client.GetSobject(ctx, nil, &sobjectDescriptor)
Java
List sobjects = sobjectsApi.getSecurityObjects("example-key", null, null, null);
KeyObject matched = sobjects.get(0); // Max 1 object will be there in the result list
Python
api_instance = sdkms.v1. SecurityObjectsApi(api_client=client)
sobjects = api_instance.get_security_objects(name = "example-key")
matched = sobjects[0]
REST API using curl
curl <Endpoint URL>/crypto/v1/keys?name=example-key -H 'Authorization: Bearer YhXwwa-6C...ig5g'