1.0 Prerequisites
Listing security objects (keys) requires a Fortanix-Data-Security-Manager account, a group, and a user or application configured in that group. You must also have one or more security objects in that group to have any results returned. See the Fortanix Data Security Manager Getting Started Guide for more details.
2.0 Authorization and Configuration
You must first authenticate and optionally configure a default API client as described in Configure API Client and Client Authentication. You may authenticate as a user or as an app. Using the API, you may list all keys belonging to all groups that the user or app belongs to.
3.0 Create a SecurityObjectsApi Client Object
Listing keys is performed with a SecurityObjectsApi
object.
import com.fortanix.sdkms.v1.api.SecurityObjectsApi();
SecurityObjectsApi sobjectsApi = new SecurityObjectsApi();
4.0 List All Keys
The getSecurityObjects method of SecurityObjectsApi can return a list of all of the security objects that the currently authorized entity can access.
import com.fortanix.sdkms.v1.model.KeyObject;
List<KeyObject> allKeys = sobjectsApi.getSecurityObjects(null, null, null, null);
5.0 Get a Key by Name
The getSecurityObjects()
method can also be used to look up keys by name. The first parameter of this method restricts the returned value to only the Security-object with the requested name.
List<KeyObject> match = sobjectsApi.getSecurityObjects("example-key", null, null, null);
6.0 Filter By Group or Creator
The final three parameters of the getSecurityObjects()
method filter the returned objects by group id, creator app id, and creator user id, respectively.
List<KeyObject> matchingKeys = sobjectsApi.getSecurityObjects(null, <group id>, null, null);
List<KeyObject> matchingKeys = sobjectsApi.getSecurityObjects(null, null, <creator app id>, null);
List<KeyObject> matchingKeys = sobjectsApi.getSecurityObjects(null, null, null, <creator user id>);
7.0 Get a Key by Key ID (UUID)
The getSecurityObject()
method of SecurityObjectsApi
will look up and return a specific key by UUID.