Client API Basics

Updated: August 9, 2017

API Objects

Calls to SmartKey functions are made through API objects. The classes for these objects are defined in the com.fortanix.sdkms.v1.api package. For example, the EncryptionAndDecryptionApi defines the method calls for encrypt(), and decrypt().

Model Objects

Most API methods take a request object as a parameter and return a response object as a result. The classes for these objects are defined in the com.fortanix.sdkms.v1.model package. For example, EncryptionAndDecryptionApi.encrypt() takes an EncryptRequest as a parameter and returns an EncryptResponse object on success.

Enumerations

Common enumerations are also defined in the com.fortanix.sdkms.v1.api package. For example, the ObjectType enumeration defines cryptographic key types like ObjectType.RSA and ObjectType.AES, and the DigestAlgorithm enumeration defines message digest algorithms like DigestAlgorithm.SHA1 and DigestAlgorithm.SHA256.

API Call Return Values

API calls generally return Result objects on success, and raise an ApiException for all types of errors. This includes transport errors such as unable to connect to the server, as well as parameter errors such as passing an incorrect encryption algorithm for an encryption request.