KMS API¶
The KeyManagementService Class¶
The kms high-level interface is available through the kms
member of a
Connection
object. The kms
member will only
be added if the otcextensions.sdk.register_otc_extensions(conn)
method is
called.
CMK (Customer Master Key) Operations¶
-
class
otcextensions.sdk.kms.v1._proxy.
Proxy
(session, *args, **kwargs) -
keys
(**query) List all master keys.
- Parameters
query (dict) – Keyword arguments which will be used to list keys. limit, marker, sequence, key_state are allowed. Key state can be: * 1 indicates that the CMK is waiting to be activated. * 2 indicates that the CMK is enabled. * 3 indicates that the CMK is disabled. * 4 indicates that the CMK is scheduled for deletion.
- Returns
a generator of (
Key
) instances
-
create_key
(**attrs) Create master key
-
get_key
(key) Describe a encrypt key by given key id or key object
-
find_key
(alias, ignore_missing=False) Find a single key
- Parameters
alias – The key alias
ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the group does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent group.
- Returns
instance of
Key
-
enable_key
(key) Enable a key
-
disable_key
(key) Disable a key
-
schedule_key_deletion
(key, pending_days=7) Schedule a key deletion
-
DEK (Data Encryption Key) Operations¶
-
class
otcextensions.sdk.kms.v1._proxy.
Proxy
(session, *args, **kwargs) -
create_datakey
(cmk, **attrs) Create a data key
-
create_datakey_wo_plain
(cmk, **attrs) Create a data key without plain text
-
encrypt_datakey
(datakey) Encrypt a data key
Requires plain_text to be filled with the hex key value. Populates cipher_text with the encrypted value.
-
decrypt_datakey
(cmk, cipher_text, datakey_cipher_length) Decrypt a data key
-
Other Operations¶
-
class
otcextensions.sdk.kms.v1._proxy.
Proxy
(session, *args, **kwargs) -
generate_random
(random_data_length=512) Generate random data
- Parameters
random_data_length – random data size in bits [0..512]
- Returns
instance of
Random
-
get_instance_number
() Get encrypt key instance total number
- Returns
instance of
InstanceNumber
-
quotas
() List quota resources for KMS service
- Returns
A generator of
Quota
objects
-