Vault | Python SDK | Keys Endpoints
Keys Endpoints
Decrypt
Vault.decrypt(item_id, cipher_text, version, additional_data)Decrypt a message using a key.
response = vault.decrypt(
id="pvi_p6g5i3gtbvqvc3u6zugab6qs6r63tqf5",
cipher_text="lJkk0gCLux+Q+rPNqLPEYw==",
version=1,
)
Decrypt structured
Vault.decrypt_structured(id, structured_data, filter, version, additional_data)Decrypt parts of a JSON object.
data = {"field1": [1, 2, "kxcbC9E9IlgVaSCChPWUMgUC3ko=", "6FfI/LCzatLRLNAc8SuBK/TDnGxp"], "field2": "data2"}
response = vault.decrypt_structured(
id="pvi_[...]",
structured_data=data,
filter="$.field1[2:4]"
)
Encrypt
Vault.encrypt(item_id, plain_text, version, additional_data)Encrypt a message using a key.
response = vault.encrypt(
id="pvi_p6g5i3gtbvqvc3u6zugab6qs6r63tqf5",
plain_text="lJkk0gCLux+Q+rPNqLPEYw==",
version=1,
)
Encrypt structured
Vault.encrypt_structured(key_id, structured_data, filter_expr, version, additional_data)Encrypt parts of a JSON object.
data = {"field1": [1, 2, "true", "false"], "field2": "data2"}
response = vault.encrypt_structured(
id="pvi_[...]",
structured_data=data,
filter="$.field1[2:4]"
)
Generate key
Vault.generate_key(key_type, purpose, algorithm, name, folder, metadata, tags, rotation_frequency, rotation_state, disabled_at, exportable)Generate a key.
response = vault.generate_key(
key_type=ItemType.SYMMETRIC_KEY,
purpose=SymmetricKeyPurpose.FPE,
algorithm=SymmetricKeyFpeAlgorithm.AES_FF3_1_256_BETA,
)
Rotate key
Vault.rotate_key(key_id, key_type, rotation_state, public_key, private_key, key)Manually rotate an asymmetric or symmetric key.
response = vault.rotate_key("pvi_...", key_type=ItemType.SYMMETRIC_KEY)
Sign
Vault.sign(id, message, version)Sign a message using a key
response = vault.sign(
id="pvi_p6g5i3gtbvqvc3u6zugab6qs6r63tqf5",
message="lJkk0gCLux+Q+rPNqLPEYw==",
version=1,
)
Store key
Vault.store_key(key_type, purpose, algorithm, public_key, private_key, key, name, folder, metadata, tags, rotation_frequency, rotation_state, disabled_at, exportable)Import a key.
response = vault.store_key(
key_type=ItemType.SYMMETRIC_KEY,
purpose=SymmetricKeyPurpose.FPE,
algorithm=SymmetricKeyFpeAlgorithm.AES_FF3_1_256_BETA,
)
Verify
Vault.verify(id, message, signature, version)Verify a signature using a key.
response = vault.verify(
id="pvi_p6g5i3gtbvqvc3u6zugab6qs6r63tqf5",
message="lJkk0gCLux+Q+rPNqLPEYw==",
signature="FfWuT2Mq/+cxa7wIugfhzi7ktZxVf926idJNgBDCysF/knY9B7M6wxqHMMPDEBs86D8OsEGuED21y3J7IGOpCQ==",
version=1,
)