Skip to main content

resource_service_keys

Creates, updates, deletes, gets or lists a resource_service_keys resource.

Overview​

Nameresource_service_keys
TypeResource
Idovh.okms.resource_service_keys

Fields​

The following fields are returned by SELECT queries:

successful operation

NameDatatypeDescription
idstring (uuid)Key ID
namestringKey name
always_sensitivebooleanWhether the key has always been sensitive since creation (wire: alwaysSensitive)
classstringClass of the key (KEY_PAIR, PUBLIC_KEY, SECRET_KEY)
consumer_countintegerNumber of declared consumers (wire: consumerCount)
consumersarrayList of declared consumers of the key
created_atstring (date-time)Creation time of the key (wire: createdAt)
curvestringCurve type for Elliptic Curve (EC) keys (P-256, P-384, P-521)
extractablebooleanWhether the key material can be extracted from the KMS
iamobjectIAM resource metadata
keysarrayThe key in JWK format
keys_pemarrayThe key in PEM format (wire: keysPEM)
never_extractablebooleanWhether the key has never been extractable at any point in its lifetime (wire: neverExtractable)
operationsarrayThe operations for which the key is intended to be used
protection_levelstringKey protection level (HSM, SOFTWARE) (wire: protectionLevel)
sensitivebooleanWhether the key material can be exposed in plaintext. If true, extraction is only allowed in wrapped form.
sizeintegerSize of the key (128, 192, 256, 384, 521, 2048, 3072, 4096)
statestringState of the key (ACTIVE, ALL, COMPROMISED, DEACTIVATED, DESTROYED, DESTROYED_COMPROMISED, PRE_ACTIVE)
typestringKey type (EC, RSA, oct)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectkey_id, okms_idformatReturns one service key and its metadata. Pass optional format to also export the key material as JWK or PEM, when the key is extractable.
listselectokms_idx_pagination_cursor, x_pagination_size, iam_tagsReturns the service keys of the service, with their metadata.
createinsertokms_idTo create a new service key, omit the key material from the request. The KMS generates it from the type, size, curve and operations you specify.<br /><br />To import an existing service key, supply its key material in the request. The key is stored in the KMS with the attributes you provide.<br /><br />For a secure BYOK import, send the key material encrypted in wrappedKeys (RSA wrap) instead of in cleartext. The KMS unwraps it with the referenced transport key and stores the resulting service key.
updateupdatekey_id, okms_idUpdates the key's name or extractability.<br /><br />You can also change the key state to activate, deactivate, or mark it as compromised. Deactivation requires deactivationReason.<br /><br />A deactivated key keeps its material in the KMS and can be reactivated later.
deletedeletekey_id, okms_idforcePermanently deletes the key and its material from the KMS. Once deleted, the key cannot be recovered.<br /><br />The key must already be deactivated, unless force is set.

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
api_hoststringThe OVHcloud API host. Selected by OVH_ENDPOINT (ovh-eu, ovh-ca or ovh-us; default ovh-eu). (default: api.eu.ovhcloud.com, x-stackQL-envVarSelector: {"envVar":"OVH_ENDPOINT","default":"ovh-eu","values":{"ovh-eu":"api.eu.ovhcloud.com","ovh-ca":"api.ca.ovhcloud.com","ovh-us":"api.us.ovhcloud.com"}})
key_idstring (uuid)Key ID (wire: keyId)
okms_idstring (uuid)Okms ID (wire: okmsId)
forcebooleanForce deletion of the key
formatstringOptional additional output format of the key
iam_tagsobjectFilter resources on IAM tags (wire: iamTags)
x_pagination_cursorstringPagination cursor (wire: X-Pagination-Cursor)
x_pagination_sizeintegerPagination size (wire: X-Pagination-Size)

SELECT examples​

Returns one service key and its metadata. Pass optional format to also export the key material as JWK or PEM, when the key is extractable.

SELECT
id,
name,
always_sensitive,
class,
consumer_count,
consumers,
created_at,
curve,
extractable,
iam,
keys,
keys_pem,
never_extractable,
operations,
protection_level,
sensitive,
size,
state,
type
FROM ovh.okms.resource_service_keys
WHERE key_id = '{{ key_id }}' -- required
AND okms_id = '{{ okms_id }}' -- required
AND format = '{{ format }}'
;

INSERT examples​

To create a new service key, omit the key material from the request. The KMS generates it from the type, size, curve and operations you specify.<br /><br />To import an existing service key, supply its key material in the request. The key is stored in the KMS with the attributes you provide.<br /><br />For a secure BYOK import, send the key material encrypted in wrappedKeys (RSA wrap) instead of in cleartext. The KMS unwraps it with the referenced transport key and stores the resulting service key.

INSERT INTO ovh.okms.resource_service_keys (
context,
curve,
extractable,
keys,
name,
operations,
protection_level,
size,
type,
okms_id
)
SELECT
'{{ context }}',
'{{ curve }}',
{{ extractable }},
'{{ keys }}',
'{{ name }}',
'{{ operations }}',
'{{ protection_level }}',
{{ size }},
'{{ type }}',
'{{ okms_id }}'
RETURNING
id,
name,
always_sensitive,
class,
consumer_count,
consumers,
created_at,
curve,
extractable,
keys,
keys_pem,
never_extractable,
operations,
protection_level,
sensitive,
size,
state,
type
;

UPDATE examples​

Updates the key's name or extractability.<br /><br />You can also change the key state to activate, deactivate, or mark it as compromised. Deactivation requires deactivationReason.<br /><br />A deactivated key keeps its material in the KMS and can be reactivated later.

UPDATE ovh.okms.resource_service_keys
SET
deactivation_reason = '{{ deactivation_reason }}',
extractable = {{ extractable }},
name = '{{ name }}',
state = '{{ state }}'
WHERE
key_id = '{{ key_id }}' --required
AND okms_id = '{{ okms_id }}' --required
RETURNING
id,
name,
always_sensitive,
class,
consumer_count,
consumers,
created_at,
curve,
extractable,
keys,
keys_pem,
never_extractable,
operations,
protection_level,
sensitive,
size,
state,
type;

DELETE examples​

Permanently deletes the key and its material from the KMS. Once deleted, the key cannot be recovered.<br /><br />The key must already be deactivated, unless force is set.

DELETE FROM ovh.okms.resource_service_keys
WHERE key_id = '{{ key_id }}' --required
AND okms_id = '{{ okms_id }}' --required
AND force = '{{ force }}'
;