Messaggi di errore
Questi messaggi di errore vengono creati da Key Protect e mostrato nell'interfaccia utente (IU).
La maggior parte dei messaggi di errore hanno uno o più esempi, di solito curl
, che mostrano la richiesta e la risposta.
Questo non è un elenco completo di messaggi di errore. Alcuni messaggi vengono creati da altri sistemi, come l'identità e la gestione degli accessi (IAM), dove il messaggio di errore viene passato da un altro sistema, ad esempio IAM, a Key Protect all'utente.
Tabella dei contenuti
La tabella dei contenuti è ordinata dal messaggio di errore.
-
Il primo elenco ordina i messaggi di errore in base al codice di stato HTTP
-
Un altro elenco ordina i messaggi di errore per codice motivo
Alcuni messaggi di errore si verificano più di una volta; in questi casi, il codice di stato HTTP è incluso alla fine del messaggio di errore incluso alla fine del messaggio di errore.
- Il totale della raccolta non corrisponde al numero... dettagli
- I dati in corpo non corrispondono ai dati richiesti ... dettagli
- Estrazione del soggetto dal portatore ... dettagli
- Sono stati passati dati del corpo non validi ... dettagli
- Errore campo non valido ... dettagli
- Non è stato possibile eliminare la chiave... dettagli
- La chiave è già stata cancellata ... dettagli
- La chiave non è in uno stato valido (409) dettagli
- La chiave non è in uno stato valido (422) dettagli
- La chiave è la protezione di uno o più cloud... dettagli
- I metadati chiave sono diventati danneggiati ... dettagli
- Il ripristino chiave è scaduto dettagli
- Politica di istanza KeyCreateImportAccess... dettagli
- Corpo mancante in richiesta dettagli
- Numero di autorizzazioni necessarie a ... dettagli
- Solo una politica di istanza singola può essere ... dettagli
- Solo le chiavi importate possono essere ripristinate dettagli
- L'azione richiesta può essere completata solo con una chiave root (400) dettagli
- L'azione richiesta può essere completata solo con una chiave root (422) dettagli
- La modifica richiesta non è conforme alle regole di configurazione dettagli
- La firma non è valida dettagli
- Non è stato possibile eseguire l'azione su... dettagli
- Il nonce criptato dato non corrisponde ... dettagli
- Il token di importazione è scaduto dettagli
- La chiave non può essere cancellata perché è ... dettagli
- La chiave non è dual auth abilitata e ... dettagli
- La chiave è stata aggiornata di recente dettagli
- Il testo cifrato fornito non è valido o... dettagli
- Il nonce criptato fornito non era ... dettagli
- Le risorse interrogate non appartengono al servizio. dettagli
- Questa azione può essere eseguita solo da un servizio... dettagli
- Questa azione non è consentita su questo ... dettagli
- Questa richiesta richiede che la versione chiave ... dettagli
- Questo tasto root è stato ruotato all'interno di ... dettagli
- Questo tasto root è stato creato con l'utente fornito ... dettagli
- Non autorizzato: l'utente non ha ... dettagli
1 - Il totale della raccolta non corrisponde al numero ...
Messaggio
Il totale della raccolta non corrisponde al numero di risorse
Codice motivo: COLLECTION_TOTAL_MISMATCH_ERR
Codice di stato HTTP
400 - Bad Request
Il codice di stato della risposta HTTP 400 Bad Request
indica che il server non può o non elaborerà la richiesta a causa di qualcosa che viene percepito come un errore del cliente (ad es errore del client (ad esempio, sintassi
della richiesta malformata, inquadramento del messaggio di richiesta non valido o instradamento ingannevole della richiesta), o instradamento ingannevole della richiesta).
Il client non deve ripetere questa richiesta senza modificazioni.
Contesto
Questo errore si verifica quando un policy di istanza viene creata.
Il valore del campo metadata.collectionTotal
non corrisponde al numero di risorse nella schiera resources
.
La richiesta create instance policy
non riesce perché la
metadata.collectionTotal
è 2, mentre la risorsa 1 (una) è stata fornita nella
resources
array.
# this request fails because the collectionTotal is 2 and there is 1 (one) resource
$ curl -X PUT \
"https://us-south.kms.cloud.ibm.com/api/v2/instance/policies?policy=dualAuthDelete" \
-H "authorization: Bearer $ACCESS_TOKEN" \
-H "bluemix-instance: $KP_INSTANCE_ID" \
-H "content-type: application/vnd.ibm.kms.policy+json" \
-d '{
"metadata": {
"collectionType": "application/vnd.ibm.kms.policy+json",
"collectionTotal": 2
},
"resources": [
{
"policy_type": "dualAuthDelete",
"policy_data": {
"enabled": false
}
}
]
}'
risposta json
{
"metadata": {
"collectionType": "application/vnd.ibm.kms.error+json",
"collectionTotal": 1
},
"resources":[
{
"errorMsg": "Bad Request: Instance policy could not be created. Please see `reasons` for more details.",
"reasons": [
{
"code": "COLLECTION_TOTAL_MISMATCH_ERR",
"message": "Collection total does not match number of resources",
"status": 400,
"moreInfo": "https://cloud.ibm.com/apidocs/key-protect"
}
]
}
]
}
2 - I dati in corpo non corrispondono ai dati richiesti ...
Messaggio
I dati del corpo non corrispondono ai dati richiesti dal parametro della query
Codice motivo: BODY_QUERY_PARAM_MISMATCH_ERR
Codice di stato HTTP
400 - Bad Request
Il codice di stato della risposta HTTP 400 Bad Request
indica che il server non può o non elaborerà la richiesta a causa di qualcosa che viene percepito come un errore del cliente (ad es errore del client (ad esempio, sintassi
della richiesta malformata, inquadramento del messaggio di richiesta non valido o instradamento ingannevole della richiesta), o instradamento ingannevole della richiesta).
Il client non deve ripetere questa richiesta senza modificazioni.
Contesto
Questo errore si verifica quando un policy di istanza viene creata.
Il parametro della query, che specifica il criterio dualAuthDelete, allowedNetwork, o allowedIP ), non corrisponde al primo policy_type
nel file resources
array.
La richiesta create instance policy
non va a buon fine perché il parametro della query policy
dualAuthDelete ) non corrisponde al parametro resources.policy_type
badName ).
# this request fails because the query parameter does not match the resource
$ curl -X PUT \
"https://us-south.kms.cloud.ibm.com/api/v2/instance/policies?policy=dualAuthDelete" \
-H "authorization: Bearer $ACCESS_TOKEN" \
-H "bluemix-instance: $KP_INSTANCE_ID" \
-H "content-type: application/vnd.ibm.kms.policy+json" \
-d '{
"metadata": {
"collectionType": "application/vnd.ibm.kms.policy+json",
"collectionTotal": 1
},
"resources": [
{
"policy_type": "badName",
"policy_data": {
"enabled": false
}
}
]
}'
risposta json
{
"metadata": {
"collectionType": "application/vnd.ibm.kms.error+json",
"collectionTotal": 1
},
"resources": [
{
"errorMsg": "Bad Request: Instance policy could not be created. Please see `reasons` for more details.",
"reasons": [
{
"code": "BODY_QUERY_PARAM_MISMATCH_ERR",
"message": "Data in body does not match data required by query parameter",
"status": 400,
"moreInfo": "https://cloud.ibm.com/apidocs/key-protect"
}
]
}
]
}
3 - Estrarre il soggetto dal portabandiera ...
Messaggio
L'estrazione dell'oggetto dal token del portatore non è riuscita: Assicurarsi che il token portatore passato sia quello corretto (e nel formato corretto) e che sia autorizzato a eseguire le azioni richieste
Codice motivo: BEARER_SUB_EXTRACTION_ERR
Codice di stato HTTP
400 - Bad Request
Il codice di stato della risposta HTTP 400 Bad Request
indica che il server non può o non elaborerà la richiesta a causa di qualcosa che viene percepito come un errore del cliente (ad es errore del client (ad esempio, sintassi
della richiesta malformata, inquadramento del messaggio di richiesta non valido o instradamento ingannevole della richiesta), o instradamento ingannevole della richiesta).
Il client non deve ripetere questa richiesta senza modificazioni.
Contesto
Il token di accesso identificativo e di accesso (IAM), o formato, non era valido. Se si tratta di una richiesta curl allora l'intestazione autorizzazione deve essere impostata utilizzando questo formato:
-H "authorization: Bearer $ACCESS_TOKEN"
A seconda della piattaforma (Linux, Mac, Windows) o della shell (bash, sh, zsh) che si sta utilizzando, è necessario essere consapevoli di utilizzare virgolette singole o doppie. Alcuni sistemi non interpretano le variabili
all'interno delle singole quotazioni. Ad esempio, ('Bearer $ACCESS_TOKEN
') potrebbe non sostituire $ACCESS_TOKEN
con il valore.
Assicurati di specificare un token IAM valido. Potrebbe essere necessario effettuare il login (di nuovo) se il proprio token è scaduto. Ecco alcune righe di codice CLI (command line interface) per effettuare il login e impostare il token di accesso.
# login with single sign on (sso)
$ ibmcloud login --sso
# set the region (-r) and resource group (-g)
$ ibmcloud target -r us-south -g Default
# set the ACCESS_TOKEN environment variable (with Bearer)
$ export ACCESS_TOKEN=`ibmcloud iam oauth-tokens | grep IAM | cut -d \: -f 2 | sed 's/^ *//'`
# show the access token
$ echo $ACCESS_TOKEN
Bearer eyJraWQiOiIyMDIwMDcyNDE4MzEiLCJh...<redacted>...o4qlcKjl9sVqLa8Q
# set the ACCESS_TOKEN environment variable (without Bearer)
$ export ACCESS_TOKEN=`ibmcloud iam oauth-tokens | grep IAM | cut -d ' ' -f 5 | sed 's/^ *//'`
eyJraWQiOiIyMDIwMDcyNDE4MzEiLCJh...<redacted>...o4qlcKjl9sVqLa8Q
4 - Sono stati passati dati del corpo non validi ...
Messaggio
Sono stati passati dati del corpo non validi: Assicurarsi che i dati passati abbiano una formattazione formattazione valida senza caratteri non validi
Codice della ragione: BAD_BODY_ERR
Codice di stato HTTP
400 - Bad Request
Il codice di stato della risposta HTTP 400 Bad Request
indica che il server non può o non elaborerà la richiesta a causa di qualcosa che viene percepito come un errore del cliente (ad es errore del client (ad esempio, sintassi
della richiesta malformata, inquadramento del messaggio di richiesta non valido o instradamento ingannevole della richiesta), o instradamento ingannevole della richiesta).
Il client non deve ripetere questa richiesta senza modificazioni.
Contesto
Alcuni esempi di questo errore sono:
-
Creare una policy di istanza
- Solo una di ogni politica può essere creata
- Non è stata fornita alcuna sezione
resources
- Campi estranei nella sezione
resources
(vedi esempio 1)
-
Crea una chiave
- Una risorsa è obbligatoria (vedi esempio 2)
- I metadati sono vuoti (vedi esempio 3)
- La chiave ha zero valore o è vuota
Esempio 1
La richiesta create instance policy
non riesce perché la risorsa contiene un campo extra (extra_field
).
# this request fails because there is an extra field in the body
$ curl -X PUT \
"https://us-south.kms.cloud.ibm.com/api/v2/instance/policies?policy=dualAuthDelete" \
-H "authorization: Bearer $ACCESS_TOKEN" \
-H "bluemix-instance: $KP_INSTANCE_ID" \
-H "content-type: application/vnd.ibm.kms.policy+json" \
-d '{
"metadata": {
"collectionType": "application/vnd.ibm.kms.policy+json",
"collectionTotal": 1
},
"resources": [
{
"policy_type": "dualAuthDelete",
"policy_data": {
"enabled": false
},
"extra_field": "junk data"
}
]
}'
risposta json
{
"metadata": {
"collectionType": "application/vnd.ibm.kms.error+json",
"collectionTotal": 1
},
"resources": [
{
"errorMsg": "Bad Request: Instance policy could not be created. Please see `reasons` for more details.",
"reasons":[
{
"code": "BAD_BODY_ERR",
"message": "Invalid body data was passed. Please ensure the data passed had valid formatting with no invalid characters: json: unknown field \"extra_field\"",
"status": 400,
"moreInfo": "https://cloud.ibm.com/apidocs/key-protect"
}
]
}
]
}
Esempio 2
La richiesta create key
non riesce perché ci sono più di 1 (una) risorsa.
# this request fails because there is more than 1 (one) resource
$ curl -X POST \
"https://us-south.kms.cloud.ibm.com/api/v2/keys" \
-H "authorization: Bearer $ACCESS_TOKEN" \
-H "bluemix-instance: $KP_INSTANCE_ID" \
-H "content-type: application/vnd.ibm.kms.key+json" \
-d '{
"metadata": {
"collectionType": "application/vnd.ibm.kms.key+json",
"collectionTotal": 1
},
"resources": [
{
"type": "application/vnd.ibm.kms.key+json",
"name": "Root-key-1",
"description": "example-key",
"extractable": false
},
{
"type": "application/vnd.ibm.kms.key+json",
"name": "Root-key-2",
"description": "example-key",
"extractable": false
}
]
}'
risposta json
{
"metadata": {
"collectionType": "application/vnd.ibm.kms.error+json",
"collectionTotal": 1
},
"resources": [
{
"errorMsg": "Bad Request: Key could not be created. Please see `reasons` for more details.",
"reasons": [
{
"code": "BAD_BODY_ERR",
"message": "Invalid body data was passed. Please ensure the data passed had valid formatting with no invalid characters: Only creation of one key per request is supported",
"status": 400,
"moreInfo": "https://cloud.ibm.com/apidocs/key-protect"
}
]
}
]
}
Esempio 3
Questa richiesta chiave non riesce perché il metadata
è vuoto.
# this request fails because the metadata is empty
$ curl -X POST \
"https://us-south.kms.cloud.ibm.com/api/v2/keys" \
-H "authorization: Bearer $ACCESS_TOKEN" \
-H "bluemix-instance: $KP_INSTANCE_ID" \
-H "content-type: application/vnd.ibm.kms.key+json" \
-d '{
"metadata": {},
"resources": [
{
"type": "application/vnd.ibm.kms.key+json",
"name": "Root-key-1",
"description": "example-key",
"extractable": false
}
]
}'
risposta json
{
"metadata": {
"collectionType": "application/vnd.ibm.kms.error+json",
"collectionTotal": 1
},
"resources": [
{
"errorMsg": "Bad Request: Key could not be created. Please see `reasons` for more details.",
"reasons": [
{
"code": "BAD_BODY_ERR",
"message": "Invalid body data was passed. Please ensure the data passed had valid formatting with no invalid characters: CollectionMetadata is empty",
"status": 400,
"moreInfo": "https://cloud.ibm.com/apidocs/key-protect"
}
]
}
]
}
5 - Errore chiave non valido ...
Messaggio
Quando si avvolge un tasto, il messaggio, The field 'plaintext' must be: a base64 encoded key material
verrà mostrato se nella richiesta viene inoltrato un testo in chiaro non valido.
Quando si smonta una chiave, il messaggio, The field 'ciphertext' must be: the original base64 encoded ciphertext from the wrap operation
se viene superato il testo cifrato non valido.
Codice di stato HTTP
400
Contesto
Una richiesta di esempio per avvolgere una chiave che fallisce:
curl -X POST \
"https://us-south.kms.cloud.ibm.com/api/v2/keys/$KEY_ID/actions/wrap" \
-H "authorization: Bearer <ACCESS_TOKEN>" \
-H "bluemix-instance: <KP_INSTANCE_ID>" \
-H "application/vnd.ibm.kms.key_action+json" \
-d '{
"plaintext": "q+x3Qi.../BVb8bPj....vVD;",
}'
Risposta:
{
"metadata": {
"collectionType": "application/vnd.ibm.kms.error+json",
"collectionTotal": 1
},
"resources": [
{
"errorMsg": "Bad Request: Wrap with key could not be performed: Please see `reasons` for more details (INVALID_FIELD_ERR)",
"reasons": [
{
"code": "INVALID_FIELD_ERR",
"message": "The field `plaintext` must be: a base64 encoded key material: illegal base64 data at input byte 38",
"status": 400,
"moreInfo": "https://cloud.ibm.com/apidocs/key-protect",
"target": {
"type": "field",
"name": "plaintext"
}
}
]
}
]
}
Una richiesta di esempio per savvolgere una chiave che fallisce:
request:
curl -X POST \
"https://us-south.kms.cloud.ibm.com/api/v2/keys/$KEY_ID/actions/unwrap" \
-H "authorization: Bearer <ACCESS_TOKEN>" \
-H "bluemix-instance: <KP_INSTANCE_ID>" \
-H "application/vnd.ibm.kms.key_action+json" \
-d '{
"ciphertext": "eyJjaXBoZXJ0ZXh0IjoiUnl...hYTUtNDNmMi05NTc5LWM2NjAzN2EwNjhkNyJ"
}'
Risposta:
{
"metadata": {
"collectionType": "application/vnd.ibm.kms.error+json",
"collectionTotal": 1
},
"resources": [
{
"errorMsg": "Bad Request: Unwrap with key could not be performed: Please see 'reasons' for more details (INVALID_FIELD_ERR)",
"reasons": [
{
"code": "INVALID_FIELD_ERR",
"message": "The field 'ciphertext' must be: the original base64 encoded ciphertext from the wrap operation: illegal base64 data at input byte 208",
"status": 400,
"moreInfo": "https://cloud.ibm.com/apidocs/key-protect",
"target": {
"type": "field",
"name": "ciphertext"
}
}
]
}
]
}
6 - Impossibile cancellare la chiave...
Codice di stato HTTP
409 - Conflitto
Il codice di risposta all'errore del client HTTP 409 Conflict
indica che un errore nella richiesta del client può essere risolto in base al codice di motivo specificato restituito.
Contesto
Il messaggio restituisce un motivo nel messaggio che fornisce il contesto specifico.
Messaggio
Codice della ragione: AUTIZATIONS_NOT_MET
La chiave non può essere cancellata perché non è riuscita la richiesta di autorizzazione duplice. Prima di eliminare questa chiave, si fanno seguire le procedure di autorizzazione duale. Consultare l'argomento, Ritorli chiavi tramite dual autorizzazione.
Codice motivo: PROTECTED_RESOURCE_ERR
La chiave non può essere cancellata perché la chiave ha una o più risorse associate. Consultare l'argomento, Considerazioni prima dell'eliminazione e della cancellazione di una chiave.
Codice della ragione: PREV_KEY_DEL_ERR
La chiave non può essere cancellata perché protegge una risorsa cloud che ha una politica di conservazione. Prima di eliminare questa chiave, contattare un account proprietario per rimuovere la politica di conservazione su ogni risorsa associata alla chiave. Consultare l'argomento, Considerazioni prima dell'eliminazione e della cancellazione di una chiave.
Esempio di risposta 1
{
"metadata": {
"collectionType": "application/vnd.ibm.kms.error+json",
"collectionTotal": 1
},
"resources": [
{
"errorMsg": "Key could not be deleted. Please 'reasons' for more details.",
"reasons": [
{
"code": "AUTHORIZATIONS_NOT_MET",
"message": "The key cannot be deleted because it failed the dual authorization request.",
"status": 409,
"moreInfo":"https://cloud.ibm.com/apidocs/key-protect"
}
]
}
]
}
Esempio di risposta 2
{
"metadata": {
"collectionType": "application/vnd.ibm.kms.error+json",
"collectionTotal": 1
},
"resources": [
{
"errorMsg": "Key could not be deleted. Please 'reasons' for more details.",
"reasons": [
{
"code": "PROTECTED_RESOURCE_ERR",
"message": "The key cannot be deleted because the key has one or more associated resources.",
"status": 409,
"moreInfo":"https://cloud.ibm.com/apidocs/key-protect"
}
]
}
]
}
Esempio di risposta 3
{
"metadata": {
"collectionType": "application/vnd.ibm.kms.error+json",
"collectionTotal": 1
},
"resources": [
{
"errorMsg": "Key could not be deleted. Please 'reasons' for more details.",
"reasons": [
{
"code": "PREV_KEY_DEL_ERR",
"message": "The key cannot be deleted because it's protecting a cloud resource that has a retention policy.",
"status": 409,
"moreInfo":"https://cloud.ibm.com/apidocs/key-protect"
}
]
}
]
}
7 - La chiave è già stata cancellata ...
Messaggio
La chiave è già stata cancellata: Cancellare i riferimenti a questa chiave
Codice motivo: KEY_DELETED_ERR
Codice di stato HTTP
410 - Gone
Il codice di risposta all'errore del client HTTP 410 Gone
indica che l'accesso alla risorsa di destinazione non è più disponibile presso il server di origine e che questo codice di risposta non è disponibile alla risorsa di destinazione
non è più disponibile presso il server di origine e che questa condizione è probabilmente permanente.
Se non si sa se questa condizione è temporanea o permanente, dovrebbe essere utilizzato un codice di stato 404.
Una risposta 410
è memorizzabile per impostazione predefinita.
Contesto
La richiesta delete key
non riesce perché la chiave è stata precedentemente cancellata. Non è possibile eliminare una chiave più di una volta.
Esempio
# delete an existing key
$ ibmcloud kp key delete $KEY_ID -i $KP_INSTANCE_ID
Deleting key: '0c17...<redacted>...5c34', from instance: 'a192...<redacted>...7411'...
OK
Deleted Key
0c17...<redeacted>...5c34
# this request fails because the key was previously deleted
$ curl -X DELETE \
"https://us-south.kms.cloud.ibm.com/api/v2/keys/$KEY_ID" \
-H "authorization: Bearer $ACCESS_TOKEN" \
-H "bluemix-instance: $KP_INSTANCE_ID" \
-H "content-type: application/vnd.ibm.kms.key+json"
risposta json
{
"metadata": {
"collectionType": "application/vnd.ibm.kms.error+json",
"collectionTotal": 1
},
"resources": [
{
"errorMsg": "Gone: Key could not be deleted. Please see `reasons` for more details.",
"reasons": [
{
"code": "KEY_DELETED_ERR",
"message": "Key has already been deleted. Please delete references to this key.",
"status": 410,
"moreInfo":"https://cloud.ibm.com/apidocs/key-protect"
}
]
}
]
}
7 - La chiave non è in uno stato valido
Messaggio
La chiave non è in uno stato valido
Codice motivo: KEY_ACTION_INVALID_STATE_ERR
Codice di stato HTTP
409 - Conflitto
Il codice di stato della risposta HTTP 409 Conflict
indica un conflitto della richiesta con lo stato attuale del server stato attuale del server.
I conflitti sono più probabili in risposta a una richiesta PUT
. Ad esempio, è possibile ottenere una risposta 409
quando si caricano un file più vecchio di quello già presente sul server risultante in un conflitto
di controllo della versione.
Contesto
Questo errore si verifica quando viene eseguita una "azione" su una chiave e la stato chiave non è valido.
Alcune azioni da considerare:
-
Lo stato chiave deve essere attivo (il valore dello stato è 1) per avvolgere, inavvolgere, ruotare, impostare chiave per la cancellazione (dual auth), chiave non impostata per l'eliminazione (dual auth) oppure disabilitare la chiave
-
Questo errore si verifica quando si cerca di abilitare una chiave scaduta (il valore dello stato è 3) o ripristinare una chiave che è stata distrutta (il valore dello stato è 5)
Esempio 1
La richiesta key disable
non riesce perché non è possibile disabilitare una chiave precedentemente disabilitata.
# disable a key the first time
$ ibmcloud kp key disable $KEY_ID -i $KP_INSTANCE_ID
Disabling key: '6933...<redacted>...5dbf', in instance: 'a192...<redacted>...7411'...
OK
# this CLI request fails because the key is deleted a second time
$ ibmcloud key disable $KEY_ID -i $KP_INSTANCE_ID
Disabling key: '69332...<redacted>...5dbf', in instance: 'a192...<redacted>...7411'...
FAILED
kp.Error:
correlation_id='aca1...<redacted>...66e9',
msg='Conflict:
Key is not in active state:
Key could not be disabled.
Please see `reasons` for more details.',
reasons='[KEY_ACTION_INVALID_STATE_ERR:
Key is not in a valid state -
FOR_MORE_INFO_REFER: https://cloud.ibm.com/apidocs/key-protect]'
# this API request fails because the key is deleted a third time
$ curl -X POST \
"https://us-south.kms.cloud.ibm.com/api/v2/keys/$KEY_ID/actions/disable" \
-H "authorization: Bearer $ACCESS_TOKEN" \
-H "bluemix-instance: $KP_INSTANCE_ID" \
-H "content-type: application/vnd.ibm.kms.key_action+json"
risposta json
{
"metadata": {
"collectionType": "application/vnd.ibm.kms.error+json",
"collectionTotal": 1
},
"resources": [
{
"errorMsg": "Conflict: Key is not in active state: Key could not be disabled. Please see `reasons` for more details.",
"reasons": [
{
"code": "KEY_ACTION_INVALID_STATE_ERR",
"message": "Key is not in a valid state",
"status": 409,
"moreInfo": "https://cloud.ibm.com/apidocs/key-protect"
}
]
}
]
}
Esempio 2
La richiesta key disable
non riesce perché la chiave è scaduta e si sta tentando di modificare lo stato chiave da disabilitato (il valore dello stato è 3) per abilitare (il valore dello stato è 1).
I seguenti passaggi restituiscono un errore key has been disabled
.
-
Creare una chiave con una data di scadenza
-
Lasciare passare la data di scadenza
-
Abilitare la chiave
# on a Mac, add 1 (one) minute to the current time
$ EXPIRE=$(date -u -v+1M "+%Y-%m-%dT%H:%M:%SZ")
$ echo $EXPIRE
# step 1 - create a key with an expiration date
$ curl -X POST \
"https://us-south.kms.cloud.ibm.com/api/v2/keys" \
-H "authorization: Bearer $ACCESS_TOKEN" \
-H "bluemix-instance: $KP_INSTANCE_ID" \
-H "content-type: application/vnd.ibm.kms.key+json" \
-d '{
"metadata": {
"collectionType": "application/vnd.ibm.kms.key+json",
"collectionTotal": 1
},
"resources": [
{
"type": "application/vnd.ibm.kms.key+json",
"name": "Root-key-1",
"description": "example-key",
"expirationDate": "'$EXPIRE'",
"extractable": false
}
]
}'
risposta json
{
"metadata": {
"collectionType": "application/vnd.ibm.kms.key+json",
"collectionTotal": 1
},
"resources": [
{
"type": "application/vnd.ibm.kms.key+json",
"id": "88d649f8-41b8-4426-b52b-45c88953d5b8",
"name": "Root-key-1",
"description": "example-key",
"state": 1,
"expirationDate": "2020-08-12T23:38:09Z",
"extractable": false,
"crn": "crn:v1:bluemix:public:kms:us-south:a/ea998d3389c3473aa0987652b46fb146:a192d603-0b8d-452f-aac3-f9e1f95e7411:key:88d649f8-41b8-4426-b52b-45c88953d5b8",
"imported": false,
"deleted": false
}
]
}
# capture the key id
$ KEY_ID=88d649f8-41b8-4426-b52b-45c88953d5b8
# step 2 - allow the expiration date to pass by sleeping for 1 (one) minute
$ sleep 60
# step 3 - fails because you cannot enable a key after the expiration date
$ curl -X POST \
"https://us-south.kms.cloud.ibm.com/api/v2/keys/$KEY_ID/actions/enable" \
-H "authorization: Bearer $ACCESS_TOKEN" \
-H "bluemix-instance: $KP_INSTANCE_ID" \
-H "content-type: application/vnd.ibm.kms.key_action+json"
risposta json
{
"metadata": {
"collectionType": "application/vnd.ibm.kms.error+json",
"collectionTotal": 1
},
"resources": [
{
"errorMsg": "Conflict: Key is not in suspended state: Key could not be enabled. Please see `reasons` for more details.",
"reasons": [
{
"code":" KEY_ACTION_INVALID_STATE_ERR",
"message": "Key is not in a valid state",
"status": 409,
"moreInfo": "https://cloud.ibm.com/apidocs/key-protect"
}
]
}
]
}
8 - La chiave non è in uno stato valido
Messaggio
La chiave non è in uno stato valido
Codice motivo: KEY_INVALID_STATE_ERR
Codice di stato HTTP
422 - Entità non processabile
Il codice di stato della risposta HTTP 422 Unprocessable Entity
indica che il il server comprende il tipo di contenuto dell'entità richiesta e la sintassi dell'entità richiesta è corretta richiesta è corretta, ma non è stato in
grado di elaborare le istruzioni contenute istruzioni contenute.
Il client non deve ripetere questa richiesta senza modificazioni.
Contesto
Questo errore si applica ai tasti utilizzati per "Registrazioni".
Lo stato chiave deve essere attivo (il valore dello stato è 1) quando si registra la chiave con una risorsa cloud.
Le registrazioni sono associazioni tra chiavi di root e altre risorse cloud, come le buste Cloud Object Storage (COS) o Cloud Databases distribuzioni.
Per ulteriori informazioni sulle Registrazioni, consultare visualizzazione delle associazioni tra le chiavi di root e le risorse IBM Cloud crittografate.
9 - La chiave è la protezione di uno o più cloud...
Messaggio
La chiave è la protezione di una o più risorse cloud
Codice motivo: PROTECTED_RESOURCE_ERR
Codice di stato HTTP
409 - Conflitto
Il codice di stato della risposta HTTP 409 Conflict
indica un conflitto della richiesta con lo stato attuale del server stato attuale del server.
I conflitti sono più probabili in risposta a una richiesta PUT
. Ad esempio, è possibile ottenere una risposta 409
quando si caricano un file più vecchio di quello già presente sul server risultante in un conflitto
di controllo della versione.
Contesto
Questo errore si applica ai tasti utilizzati per "Registrazioni".
Una chiave registrata per una risorsa cloud non può essere cancellata a meno che la
force
è specificata.
È necessario utilizzare l'opzione force
per eliminare un tasto root registrato con un'altra risorsa cloud.
Le registrazioni sono associazioni tra chiavi di root e altre risorse cloud, come le buste Cloud Object Storage (COS) o Cloud Databases distribuzioni.
Per ulteriori informazioni sulle Registrazioni, consultare visualizzazione delle associazioni tra le chiavi di root e le risorse IBM Cloud crittografate.
Vedi questa spiegazione di eliminazione delle chiavi registrate con un'altra risorsa cloud (guarda la Opzione force
).
# this CLI request fails because the registration was not deleted
$ ibmcloud kp key delete $KEY_ID -i $KP_INSTANCE_ID
Deleting key: 52a9d772-8982-4620-bfb4-b070dd812a0c, from instance: b0d84b32-09d0-4314-8049-da78e3b9ab6f...
FAILED
kp.Error:
correlation_id='c27b7948-4a1f-4cbd-8770-cb3616888e27',
msg='Conflict:
Key could not be deleted.
Please see "reasons" for more details.',
reasons='[PROTECTED_RESOURCE_ERR:
Key is protecting one or more cloud resources -
FOR_MORE_INFO_REFER: https://cloud.ibm.com/docs/key-protect?topic=key-protect-troubleshooting#unable-to-delete-keys]'
# this CLI request succeeds when using the --force option
# the registration between Key Protect and the cloud resource exists
$ ibmcloud kp key delete $KEY_ID -i $KP_INSTANCE_ID --force --output json
{
"id": "52a9d772-8982-4620-bfb4-b070dd812a0c"
}
10 - I metadati chiave sono diventati danneggiati ...
Messaggio
I metadati della chiave sono stati danneggiati: Cancellare la chiave
Codice motivo: INCOMPLETE_METADATA_ERR
Codice di stato HTTP
500 - Errore interno del server
Il codice di risposta di errore del server HTTP 500 Internal Server
indica che il server ha riscontrato una condizione inattesa che gli ha impedito di soddisfare la richiesta ha riscontrato una condizione inaspettata che gli ha
impedito di soddisfare la richiesta richiesta.
Questa risposta di errore è una risposta generica "catch-all". Di solito, questo indica che il server non può trovare un codice di errore 5xx migliore alla risposta. A volte, gli amministratori del server registrano risposte di errore come il codice di stato 500 con maggiori dettagli sulla richiesta di impedire che l'errore accada di nuovo in futuro.
Contesto
Questo errore viene restituito quando c'è un errore interno.
Se si ottiene questo errore si prega di contattare IBM supporto
11 - Il ripristino della chiave è scaduto
Messaggio
Il ripristino chiave è scaduto
Codice della ragione: KEY_RIPRISTINE_SCADUTO
Codice di stato HTTP
400 - Bad Request
Il codice di stato della risposta HTTP 400 Bad Request
indica che il server non può o non elaborerà la richiesta a causa di qualcosa che viene percepito come un errore del cliente (ad es errore del client (ad esempio, sintassi
della richiesta malformata, inquadramento del messaggio di richiesta non valido o instradamento ingannevole della richiesta), o instradamento ingannevole della richiesta).
Il client non deve ripetere questa richiesta senza modificazioni.
Contesto
Questo errore si verifica quando si cerca di ripristinare una chiave cancellata più di 30 giorni fa.
12 - Politica di istanza KeyCreateImportAccess...
Messaggio
Il criterio dell'istanza KeyCreateImportAccess non consente questa azione
Codice motivo: KEY_CREATE_IMPORT_ACCESS_ERR
Codice di stato HTTP
409 - Conflitto
Il codice di stato della risposta HTTP 409 Conflict
indica un conflitto della richiesta con lo stato attuale del server stato attuale del server.
I conflitti sono più probabili in risposta a una richiesta PUT
. Ad esempio, è possibile ottenere una risposta 409
quando si caricano un file più vecchio di quello già presente sul server risultante in un conflitto
di controllo della versione.
Contesto
La policy di istanza KeyCreateImportAccess
è stata abilitata e non è stata consentita una richiesta di creazione o importazione di una chiave.
Ad esempio, la policy dell'istanza non consente di creare un tasto standard e una richiesta di creazione di una chiave standard è stata respinta.
Esempio
I seguenti passaggi restituiscono questo errore.
-
Abilitare la policy dell'istanza e impedire la creazione di chiavi standard
-
Tentativo di creare una chiave standard, che fallisce
-
Rimuovere (disabilitare) la policy dell'istanza, che consente di creare chiavi standard
-
Creare una chiave standard, che riesca
# step 1 - enable an instance policy, which prevents creating standard keys
$ curl -X PUT \
"https://us-south.kms.cloud.ibm.com/api/v2/instance/policies?policy=keyCreateImportAccess" \
-H "accept: application/vnd.ibm.kms.policy+json" \
-H "authorization: Bearer $ACCESS_TOKEN" \
-H "bluemix-instance: $KP_INSTANCE_ID" \
-H "content-type: application/vnd.ibm.kms.policy+json" \
-d '{
"metadata": {
"collectionType": "application/vnd.ibm.kms.policy+json",
"collectionTotal": 1
},
"resources": [
{
"policy_type": "keyCreateImportAccess",
"policy_data": {
"enabled": true,
"attributes": {
"create_root_key": true,
"create_standard_key": false,
"import_root_key": true,
"import_standard_key": true,
"enforce_token": true
}
}
}
]
}'
# step 2a - fails when using the ibmcloud CLI
# because the instance policy prevents creating standard keys
$ ibmcloud kp key create my-standard-key --standard-key
FAILED
kp.Error:
correlation_id='43c45c85-7a1f-478c-b235-49decec8c88f',
msg='Conflict:
Key could not be created:
Please see `reasons` for more details (KEY_CREATE_IMPORT_ACCESS_ERR)',
reasons='[KEY_CREATE_IMPORT_ACCESS_ERR:
KeyCreateImportAccess instance policy does not allow this action -
FOR_MORE_INFO_REFER: https://cloud.ibm.com/apidocs/key-protect]'
# step 2b - fails when using the the ibmcloud API
# because the instance policy prevents creating standard keys
$ curl -X POST \
"https://us-south.kms.cloud.ibm.com/api/v2/keys" \
-H "authorization: Bearer $ACCESS_TOKEN" \
-H "bluemix-instance: $KP_INSTANCE_ID" \
-H "content-type: application/vnd.ibm.kms.key+json" \
-d '{
"metadata": {
"collectionType": "application/vnd.ibm.kms.key+json",
"collectionTotal": 1
},
"resources": [
{
"type": "application/vnd.ibm.kms.key+json",
"name": "my-standard-key",
"description": "my-standard-key",
"extractable": true
}
]
}'
Risposta JSON da ibmcloud API
{
"metadata": {
"collectionType": "application/vnd.ibm.kms.error+json",
"collectionTotal": 1
},
"resources": [
{
"errorMsg": "Conflict: Key could not be created: Please see `reasons` for more details (KEY_CREATE_IMPORT_ACCESS_ERR)",
"reasons": [
{
"code": "KEY_CREATE_IMPORT_ACCESS_ERR",
"message": "KeyCreateImportAccess instance policy does not allow this action",
"status": 409,
"moreInfo": "https://cloud.ibm.com/apidocs/key-protect"
}
]
}
]
}
Passi 3 - 4 disabilita la politica keyCreateImportAccess
e crea con successo un tasto standard.
# step 3 - disable the policy, that is, enable creating standard keys
$ curl -X PUT \
"https://us-south.kms.cloud.ibm.com/api/v2/instance/policies?policy=keyCreateImportAccess" \
-H "accept: application/vnd.ibm.kms.policy+json" \
-H "authorization: Bearer $ACCESS_TOKEN" \
-H "bluemix-instance: $KP_INSTANCE_ID" \
-H "content-type: application/vnd.ibm.kms.policy+json" \
-d '{
"metadata": {
"collectionType": "application/vnd.ibm.kms.policy+json",
"collectionTotal": 1
},
"resources": [
{
"policy_type": "keyCreateImportAccess",
"policy_data": {
"enabled": false
}
}
]
}'
# step 4a - create a standard key using the ibmcloud CLI
$ ibmcloud kp key create my-standard-key --standard-key -o json
{
"id": "3511e0bc-e32d-40b8-b6c2-96cd651858a4",
"name": "my-standard-key",
"type": "application/vnd.ibm.kms.key+json",
"extractable": true,
"state": 1,
"crn": "crn:v1:bluemic:public:kms:us-south:a/819bdf4436ef4c198fdf4f0b81d53116:87fa68d0-fa10-47d0-a201-603949808530:key:3511e0bc-e32d-40b8-b6c2-96cd651858a4",
"deleted": false
}
# step 4b - create a standard key using the ibmcloud API
curl -X POST \
"https://us-south.kms.cloud.ibm.com/api/v2/keys" \
-H "authorization: Bearer $ACCESS_TOKEN" \
-H "bluemix-instance: $KP_INSTANCE_ID" \
-H "content-type: application/vnd.ibm.kms.key+json" \
-d '{
"metadata": {
"collectionType": "application/vnd.ibm.kms.key+json",
"collectionTotal": 1
},
"resources": [
{
"type": "application/vnd.ibm.kms.key+json",
"name": "my-standard-key",
"description": "my-standard-key",
"extractable": true
}
]
}'
Risposta JSON da ibmcloud API
{
"metadata": {
"collectionType": "application/vnd.ibm.kms.key+json",
"collectionTotal": 1
},
"resources": [
{
"type": "application/vnd.ibm.kms.key+json",
"id": "60d72058-ec53-4d77-b7ef-ba56443e76d5",
"name": "my-standard-key",
"description": "my-standard-key",
"state": 1,
"extractable": true,
"crn":"crn:v1:bluemix:public:kms:us-south:a/819bdf4436ef4c198fdf4f0b81d53116:87fa68d0-fa10-47d0-a201-603949808530:key:60d72058-ec53-4d77-b7ef-ba56443e76d5",
"imported": false,
"deleted": false
}
]
}
13 - Corpo mancante nella richiesta
Messaggio
Corpo mancante in richiesta
Codice della ragione: NO_BODY_ERR
Codice di stato HTTP
400 - Bad Request
Il codice di stato della risposta HTTP 400 Bad Request
indica che il server non può o non elaborerà la richiesta a causa di qualcosa che viene percepito come un errore del cliente (ad es errore del client (ad esempio, sintassi
della richiesta malformata, inquadramento del messaggio di richiesta non valido o instradamento ingannevole della richiesta), o instradamento ingannevole della richiesta).
Il client non deve ripetere questa richiesta senza modificazioni.
Contesto
Questo errore si verifica quando si "avvolge" o "unwrap" una chiave e non c'è il corpo.
Esempio
I seguenti passaggi restituiscono un errore missing body in request
.
-
Crea una chiave root
-
Creare una chiave di codifica dei dati (DEK), questo è il
plaintext
-
Avvolgere il DEK con la chiave principale, questo crea un
ciphertext
-
Richiesta fallisce per non avvolgere il nuovo testo cifrato per rivelare l'originale DEK (testo in chiaro) a causa di un corpo scomparso
-
Richiesta riesce a scartare il nuovo testo cifrato per rivelare l'originale DEK (testo in chiaro) perché il corpo è specificato
# step 1 - create a root key
$ KEY_ID=$(ibmcloud kp key create example-key -i $KP_INSTANCE_ID --output json | jq -r '.["id"]')
$ echo $KEY_ID
66ffaf5b-86c8-4a50-8a2a-920ae71f86dc
# step 2 - create a random, base64-encoded, 32-byte data encryption key (DEK)
$ PLAINTEXT=$(openssl rand -base64 32)
$ echo $PLAINTEXT
2eLAD3LyD3H2bq8dIDAy0A/lN9DSE/Ne3bwu40CdErs=
# step 3 - wrap the DEK (plaintext key) with the root key, creating the ciphertext
$ CIPHERTEXT=$(ibmcloud kp key wrap $KEY_ID -i $KP_INSTANCE_ID -p $PLAINTEXT --output json | jq -r '.["Ciphertext"]')
$ echo $CIPHERTEXT
eyJjaXBoZXJ0ZXh0IjoiR0VnTFZGSmpK...<redacted>...YWU3MWY4NmRjIn0=
# step 4 - fails to unwrap the ciphertext, which reveals the original DEK
# (plaintext), because there is no body (the -d option)
$ curl -X POST \
"https://us-south.kms.cloud.ibm.com/api/v2/keys/$KEY_ID/actions/unwrap" \
-H "authorization: Bearer $ACCESS_TOKEN" \
-H "bluemix-instance: $KP_INSTANCE_ID" \
-H "content-type: application/vnd.ibm.kms.key_action+json"
risposta json
{
"metadata": {
"collectionType": "application/vnd.ibm.kms.error+json",
"collectionTotal": 1
},
"resources": [
{
"errorMsg": "Bad Request: Action could not be performed on key. Please see `reasons` for more details.",
"reasons": [
{
"code": "NO_BODY_ERR",
"message": "Missing body in request",
"status": 400,
"moreInfo": "https://cloud.ibm.com/apidocs/key-protect"
}
]
}
]
}
# step 5 - succeeds to unwrap the ciphertext because the request is complete
$ curl -X POST \
"https://us-south.kms.cloud.ibm.com/api/v2/keys/$KEY_ID/actions/unwrap" \
-H "authorization: Bearer $ACCESS_TOKEN" \
-H "bluemix-instance: $KP_INSTANCE_ID" \
-H "content-type: application/vnd.ibm.kms.key_action+json" \
-d '{
"ciphertext": "'$CIPHERTEXT'"
}'
risposta json
{
"plaintext": "2eLAD3LyD3H2bq8dIDAy0A/lN9DSE/Ne3bwu40CdErs=",
"keyVersion": {
"id": "66ffaf5b-86c8-4a50-8a2a-920ae71f86dc"
}
}
15 - Solo una politica di istanza singola può essere ...
Messaggio
Per ogni parametro della query può essere creato un solo criterio di istanza: Si prega di passare un singolo oggetto risorsa
Codice motivo: NUM_COLLECTION_RESOURCE_ERR
Codice di stato HTTP
400 - Bad Request
Il codice di stato della risposta HTTP 400 Bad Request
indica che il server non può o non elaborerà la richiesta a causa di qualcosa che viene percepito come un errore del cliente (ad es errore del client (ad esempio, sintassi
della richiesta malformata, inquadramento del messaggio di richiesta non valido o instradamento ingannevole della richiesta), o instradamento ingannevole della richiesta).
Il client non deve ripetere questa richiesta senza modificazioni.
Contesto
La richiesta create instance policy
fallisce perché la stessa politica è stata specificata più di una volta.
È possibile specificare più politiche nella richiesta finché ogni politica è univicabile. Ad esempio, si potrebbero creare politiche di istanza per dualAuthDelete
e
allowedIP
nella stessa richiesta.
Esempio
Questa richiesta non riesce perché è stata fornita più di una policy di istanza.
# this request fails because the dualAuthDelete policy was specified more than once
$ curl -X PUT \
"https://us-south.kms.cloud.ibm.com/api/v2/instance/policies?policy=dualAuthDelete" \
-H "authorization: Bearer $ACCESS_TOKEN" \
-H "bluemix-instance: $KP_INSTANCE_ID" \
-H "content-type: application/vnd.ibm.kms.policy+json" \
-d '{
"metadata": {
"collectionType": "application/vnd.ibm.kms.policy+json",
"collectionTotal": 2
},
"resources": [
{
"policy_type": "dualAuthDelete",
"policy_data": {
"enabled": false
}
},
{
"policy_type": "dualAuthDelete",
"policy_data": {
"enabled": false
}
}
]
}'
risposta json
{
"metadata": {
"collectionType": "application/vnd.ibm.kms.error+json",
"collectionTotal": 1
},
"resources": [
{
"errorMsg": "Bad Request: Instance policy could not be created. Please see `reasons` for more details.",
"reasons": [
{
"code": "NUM_COLLECTION_RESOURCE_ERR",
"message": "Only a single instance policy may be created per query parameter. Please pass single resource object",
"status": 400,
"moreInfo": "https://cloud.ibm.com/apidocs/key-protect"
}
]
}
]
}
16 - È possibile ripristinare solo le chiavi importate
Messaggio
È possibile ripristinare solo le chiavi importate
Codice motivo: KEY_IMPT_REQ_ERR
Codice di stato HTTP
400 - Bad Request
Il codice di stato della risposta HTTP 400 Bad Request
indica che il server non può o non elaborerà la richiesta a causa di qualcosa che viene percepito come un errore del cliente (ad es errore del client (ad esempio, sintassi
della richiesta malformata, inquadramento del messaggio di richiesta non valido o instradamento ingannevole della richiesta), o instradamento ingannevole della richiesta).
Il client non deve ripetere questa richiesta senza modificazioni.
Contesto
Key Protect può ripristinare un tasto root eliminato in precedenza, che ripristina l'accesso ai propri dati associati nel cloud.
Come admin potrebbe essere necessario ripristinare un tasto root importato in Key Protect per accedere ai dati la chiave precedentemente protetta.
Quando si ripristina una chiave, si sposta la chiave dalla Distrutta (il valore dello stato è 5) allo stato Attivo (valore dello stato è 1) e si ripristina l'accesso a qualsiasi dato precedentemente crittografato con la chiave.
È possibile ripristinare una chiave cancellata entro 30 giorni dalla sua cancellazione. Questa funzionalità è disponibile solo per i tasti di root che sono stati creati con un key material
, noto anche come "payload".
È possibile ripristinare solo i tasti root creati con un key material
, utilizzando il comando kp key create
con l'opzione -k, --key-material
. non è possibile ripristinare un tasto root se l'opzione
--key-material
era non specificata.
Se si desidera ripristinare un tasto root eliminato allora deve salvare la
key material
utilizzato per creare la chiave principale. non è possibile ripristinare una chiave cancellata senza fornire l'originale key material
.
Esempio
Segui questi passaggi per creare l'errore only imported keys may be restored
.
-
Creare un tasto root senza un materiale chiave (payload)
-
Elimina la chiave
-
Sonno 30 seconds
-
Creare un materiale chiave
-
Ripristinare la chiave e fornire un materiale chiave (payload)
# step 1 - create a root key without a key material (payload)
$ KEY_ID=$(ibmcloud kp key create example-key -i $KP_INSTANCE_ID --output json | jq -r '.["id"]')
$ echo $KEY_ID
e631925f-affb-457e-886d-57cb2a5f565b
# step 2 - delete the key
$ ibmcloud kp key delete $KEY_ID -i $KP_INSTANCE_ID
Deleting key: 'e631925f-affb-457e-886d-57cb2a5f565b', from instance: 'a192d603-0b8d-452f-aac3-f9e1f95e7411'...
OK
Deleted Key
e631925f-affb-457e-886d-57cb2a5f565b
# step 3 - sleep 30 seconds
$ sleep 30
# step 4 - create a key material
$ KEY_MATERIAL=$(openssl rand -base64 32)
$ echo $KEY_MATERIAL
lZM/guRnn/VklwRBoNOP/AUdCtpDNSo3+xXXhwrnO7c=
# step 5 - this CLI request fails because you can only restore keys
# that were imported (created with a key material or an import token)
$ ibmcloud kp key restore $KEY_ID -i $KP_INSTANCE_ID --key-material $KEY_MATERIAL
Restoring key: 'e631925f-affb-457e-886d-57cb2a5f565b', in instance: 'a192d603-0b8d-452f-aac3-f9e1f95e7411'...
FAILED
kp.Error:
correlation_id='6d000f60-47f2-4a49-ba72-f02a8efa2945',
msg='Bad Request:
Key could not be restored.
Please see `reasons` for more details.',
reasons='[KEY_IMPT_REQ_ERR:
Only imported keys may be restored. -
FOR_MORE_INFO_REFER: https://cloud.ibm.com/apidocs/key-protect]'
# step 5 - this API request fails because you can only restore keys
# that were imported (created with a key material or an import token)
$ curl -X POST \
"https://us-south.kms.cloud.ibm.com/api/v2/keys/$KEY_ID/restore" \
-H "authorization: Bearer $ACCESS_TOKEN" \
-H "bluemix-instance: $KP_INSTANCE_ID" \
-H "content-type: application/vnd.ibm.kms.key_action+json" \
-d '{
"metadata": {
"collectionType": "application/vnd.ibm.kms.key+json",
"collectionTotal": 1
},
"resources": [
{
"payload": "'$KEY_MATERIAL'"
}
]
}'
risposta json
{
"metadata": {
"collectionType": "application/vnd.ibm.kms.error+json",
"collectionTotal": 1
},
"resources": [
{
"errorMsg": "Bad Request: Key could not be restored. Please see `reasons` for more details.",
"reasons": [
{
"code": "KEY_IMPT_REQ_ERR",
"message": "Only imported keys may be restored.",
"status": 400,
"moreInfo": "https://cloud.ibm.com/apidocs/key-protect"
}
]
}
]
}
17 - L'azione richiesta può essere completata solo ...
Messaggio
L'azione richiesta può essere completata solo con una chiave root
Codice motivo: KEY_ROOT_REQ_ERR
Codice di stato HTTP
400 - Bad Request
Il codice di stato della risposta HTTP 400 Bad Request
indica che il server non può o non elaborerà la richiesta a causa di qualcosa che viene percepito come un errore del cliente (ad es errore del client (ad esempio, sintassi
della richiesta malformata, inquadramento del messaggio di richiesta non valido o instradamento ingannevole della richiesta), o instradamento ingannevole della richiesta).
Il client non deve ripetere questa richiesta senza modificazioni.
Contesto
Molte "azioni" chiave possono essere eseguite solo su chiavi "root". Questo è un elenco di comandi che possono essere eseguiti solo su chiavi di root.
- Disabilita chiave
- Abilita chiave
- Ripristina chiave
- Ruota chiave
- Annullamento wrapping della chiave
- Wrapping della chiave
Esempio
Questo esempio crea un tasto "standard" poi tenta di disabilitarlo. Questo non riesce perché solo le chiavi "root" possono essere disabilitate.
# create a standard key
$ KEY_ID=$(ibmcloud kp key create example-key -i $KP_INSTANCE_ID --output json --standard-key | jq -r '.["id"]')
$ echo $KEY_ID
b2dae7bb-2da5-493e-99d2-a6379e35e58c
# this request fails because a standard key cannot be disabled
$ curl -X POST \
"https://us-south.kms.cloud.ibm.com/api/v2/keys/$KEY_ID/actions/disable" \
-H "authorization: Bearer $ACCESS_TOKEN" \
-H "bluemix-instance: $KP_INSTANCE_ID" \
-H "content-type: application/vnd.ibm.kms.key_action+json"
risposta json
{
"metadata": {
"collectionType": "application/vnd.ibm.kms.error+json",
"collectionTotal": 1
},
"resources": [
{
"errorMsg": "Bad Request: Key could not be disabled. Please see `reasons` for more details.",
"reasons": [
{
"code": "KEY_ROOT_REQ_ERR",
"message": "Requested action can only be completed with a root key.",
"status": 400,
"moreInfo": "https://cloud.ibm.com/apidocs/key-protect"
}
]
}
]
}
18 - L'azione richiesta può essere completata solo ...
Messaggio
L'azione richiesta può essere completata solo con una chiave root
Codice motivo: KEY_ROOT_REQ_REG_ERR
Codice di stato HTTP
422 - Entità non processabile
Il codice di stato della risposta HTTP 422 Unprocessable Entity
indica che il il server comprende il tipo di contenuto dell'entità richiesta e la sintassi dell'entità richiesta è corretta richiesta è corretta, ma non è stato in
grado di elaborare le istruzioni contenute istruzioni contenute.
Il client non deve ripetere questa richiesta senza modificazioni.
Contesto
Questo errore si applica ai tasti utilizzati per "Registrazioni". Una chiave "root" è necessaria per creare una registrazione. Questo errore viene restituito quando un crea richiesta API di registrazione viene effettuata.
Le registrazioni sono associazioni tra chiavi di root e altre risorse cloud, come le buste Cloud Object Storage (COS) o Cloud Databases distribuzioni.
Per ulteriori informazioni sulle Registrazioni, consultare visualizzazione delle associazioni tra le chiavi di root e le risorse IBM Cloud crittografate.
19 - Il cambiamento richiesto non è conforme ...
Messaggio
La modifica richiesta non è conforme alle regole di configurazione
Codice della ragione: CONFIG_RULE_CONFLT_ERR
Codice di stato HTTP
403 - Vietato
Il codice di risposta allo stato di errore del client HTTP 403 Forbidden
indica che il server ha compreso la richiesta ma rifiuta di autorizzarla server ha compreso la richiesta ma si rifiuta di autorizzarla.
Questo stato è simile a 401
, ma in questo caso, ri - autenticarsi non farà alcuna differenza. L'accesso è permanentemente vietato e legato alla logica applicativa, come i diritti insufficienti ad una risorsa.
Contesto
Questo messaggio di errore si verifica quando una policy di istanza impedisce l'accesso a una risorsa. Ad esempio, se la richiesta originata da un indirizzo IP pubblico e la policy dell'istanza vieta l'accesso da un indirizzo IP pubblico, allora riceverete questo messaggio di errore.
20 - La firma non è valida
Messaggio
La firma non è valida
Codice motivo: INVALID_SIG_EXP_ERR
Codice di stato HTTP
422 - Entità non processabile
Il codice di stato della risposta HTTP 422 Unprocessable Entity
indica che il il server comprende il tipo di contenuto dell'entità richiesta e la sintassi dell'entità richiesta è corretta richiesta è corretta, ma non è stato in
grado di elaborare le istruzioni contenute istruzioni contenute.
Il client non deve ripetere questa richiesta senza modificazioni.
Contesto
Si è verificato un errore durante il riavvolgimento di una chiave.
Se si ottiene questo errore si prega di contattare IBM supporto
21 - L'azione non poteva essere eseguita su ...
Messaggio
Non è stato possibile eseguire l'azione sulla chiave perché la chiave è scaduta
Codice della ragione: KEY_EXPIRED_ERR
Codice di stato HTTP
400 - Bad Request
Il codice di stato della risposta HTTP 400 Bad Request
indica che il server non può o non elaborerà la richiesta a causa di qualcosa che viene percepito come un errore del cliente (ad es errore del client (ad esempio, sintassi
della richiesta malformata, inquadramento del messaggio di richiesta non valido o instradamento ingannevole della richiesta), o instradamento ingannevole della richiesta).
Il client non deve ripetere questa richiesta senza modificazioni.
Contesto
Questo errore si verifica quando si ripristina una chiave cancellata dopo che la chiave è scaduta.
Esempio
Una richiesta key restore
non riesce perché la chiave viene eliminata e la chiave è scaduta.
I seguenti passaggi creeranno questo errore.
-
Creare un materiale chiave (payload) e una data di scadenza
-
Creare un tasto root utilizzando il materiale chiave e la data di scadenza
-
Cattura l'id chiave
-
Lasciare passare la data di scadenza
-
Elimina la chiave
-
Ripristinare la chiave, che fallisce perché non è possibile ripristinare una chiave cancellata dopo la data di scadenza
# step 1 - create a key material (payload) and an expiration date
# create an expiration date, on a Mac, add 1 (one) minute to the current time
$ KEY_MATERIAL=$(openssl rand -base64 32)
$ EXPIRE=$(date -u -v+1M "+%Y-%m-%dT%H:%M:%SZ")
# step 2 - Create a root key using the key material and the expiration date
$ curl -X POST \
"https://us-south.kms.cloud.ibm.com/api/v2/keys" \
-H "authorization: Bearer $ACCESS_TOKEN" \
-H "bluemix-instance: $KP_INSTANCE_ID" \
-H "content-type: application/vnd.ibm.kms.key+json" \
-d '{
"metadata": {
"collectionType": "application/vnd.ibm.kms.key+json",
"collectionTotal": 1
},
"resources": [
{
"type": "application/vnd.ibm.kms.key+json",
"name": "Root-key-1",
"payload": "'$KEY_MATERIAL'",
"description": "example-key",
"expirationDate": "'$EXPIRE'",
"extractable": false
}
]
}'
risposta json
{
"metadata": {
"collectionType": "application/vnd.ibm.kms.key+json",
"collectionTotal": 1
},
"resources": [
{
"type": "application/vnd.ibm.kms.key+json",
"id": "aa713df1-857c-4c46-be80-3051756280c9",
"name": "Root-key-1",
"description": "example-key",
"state": 1,
"expirationDate": "2020-08-14T19:33:47Z",
"extractable": false,
"crn": "crn:v1:bluemix:public:kms:us-south:a/ea998d3389c3473aa0987652b46fb146:a192d603-0b8d-452f-aac3-f9e1f95e7411:key:aa713df1-857c-4c46-be80-3051756280c9",
"imported": true,
"deleted": false
}
]
}
# step 3 - capture the key id
$ KEY_ID=aa713df1-857c-4c46-be80-3051756280c9
# step 4 - allow the expiration date to pass by sleeping for 1 (one) minute
$ sleep 60
# step 5 - delete the key
$ ibmcloud kp key delete $KEY_ID
Deleting key: 'aa713df1-857c-4c46-be80-3051756280c9', from instance: 'a192d603-0b8d-452f-aac3-f9e1f95e7411'...
OK
Deleted Key
aa713df1-857c-4c46-be80-3051756280c9
# step 6 - fails because you cannot restore a deleted key after the expiration date
$ curl -X POST \
"https://us-south.kms.cloud.ibm.com/api/v2/keys/$KEY_ID/restore" \
-H "authorization: Bearer $ACCESS_TOKEN" \
-H "bluemix-instance: $KP_INSTANCE_ID" \
-H "content-type: application/vnd.ibm.kms.key_action+json" \
-d '{
"metadata": {
"collectionType": "application/vnd.ibm.kms.key+json",
"collectionTotal": 1
},
"resources": [
{
"payload": "'$KEY_MATERIAL'"
}
]
}'
risposta json
{
"metadata": {
"collectionType": "application/vnd.ibm.kms.error+json",
"collectionTotal": 1
},
"resources": [
{
"errorMsg": "Bad Request: The key expired on 2020-08-14 19:33:47 +0000 UTC: Key could not be restored. Please see `reasons` for more details.",
"reasons": [
{
"code": "KEY_EXPIRED_ERR",
"message": "The action could not be performed on the key because the key is expired.",
"status": 400,
"moreInfo": "https://cloud.ibm.com/apidocs/key-protect"
}
]
}
]
}
22 - Il nonce criptato dato non corrisponde ...
Messaggio
Il nonce criptato fornito non corrisponde al record esistente: Assicurarsi che il nonce corretto sia stato fornito nella richiesta
Codice motivo: INCORRECT_NONCE_ERR
Codice di stato HTTP
400 - Bad Request
Il codice di stato della risposta HTTP 400 Bad Request
indica che il server non può o non elaborerà la richiesta a causa di qualcosa che viene percepito come un errore del cliente (ad es errore del client (ad esempio, sintassi
della richiesta malformata, inquadramento del messaggio di richiesta non valido o instradamento ingannevole della richiesta), o instradamento ingannevole della richiesta).
Il client non deve ripetere questa richiesta senza modificazioni.
Contesto
Questo messaggio di errore è applicabile alle interfacce chiave restore
e rotate
.
Questo esempio si basa sul comando chiave restore
e utilizza il
CLI perché l'output è più facile da seguire rispetto a
API.
Passo 1- impostare il problema creando un tasto root utilizzando un token di importazione e quindi eliminare la chiave
# create an import token that expires in 15 minutes (900 seconds) and allows 10 retrievals
$ ibmcloud kp import-token create -e 900 -m 10
Created Expires Max Retrievals Remaining Retrievals
2020-08-18 19:05:51 +0000 UTC 2020-08-18 19:20:51 +0000 UTC 10 10
# create a random, base64-encoded, 32-byte key material
$ KEY_MATERIAL=$(openssl rand -base64 32)
$ echo $KEY_MATERIAL
DL4Avc1yL7DhclfV9Uksvzy8VkYIKWZA9InYQv/iiro=
# extract the nonce that was created by the "kp import-token create" command
$ NONCE=$(ibmcloud kp import-token show | jq -r '.["nonce"]')
$ echo $NONCE
6SB0nQ8ROUCPUiyF
# extract the public key that was created by the "kp import-token create" command
$ PUBLIC_KEY=$(ibmcloud kp import-token show | jq -r '.["payload"]')
$ echo $PUBLIC_KEY
LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0t ...<redacted>... QyBLRVktLS0tLQo=
# encrypt the key material using the public key
$ ibmcloud kp import-token key-encrypt -k $KEY_MATERIAL -p $PUBLIC_KEY
Encrypted Key
rATe0oyYy+793MDlxQi2kJxf5BqLbmVY ...<redacted>... gNVJ5oxm7KX94iE=
# capture the encrypted key material
$ ENCRYPTED_KEY=rATe0oyYy+793MDlxQi2kJxf5BqLbmVY ...<redacted>... gNVJ5oxm7KX94iE=
# encrypt the nonce
$ ibmcloud kp import-token nonce-encrypt -k $KEY_MATERIAL -n $NONCE
Encrypted Nonce IV
+KjUDFD38r8zlXKJkn+dOR4/xNYN5ozpvKCiIQ== CSPZwm2qJ5mL00oP
# capture the encrypted nonce and the initialization vector (IV)
$ ENCRYPTED_NONCE=+KjUDFD38r8zlXKJkn+dOR4/xNYN5ozpvKCiIQ==
$ IV=CSPZwm2qJ5mL00oP
# create a root key using an import token, provide an encrypted key, nonce, and initialization vector (IV)
$ KEY_ID=$(ibmcloud kp key create my-imported-root-key -k $ENCRYPTED_KEY -n $ENCRYPTED_NONCE -v $IV --output json | jq -r '.["id"]')
$ echo $KEY_ID
fa0a7d81-a947-4bac-883d-952f6288f0a9
# delete the root key
$ ibmcloud kp key delete $KEY_ID
Deleting key: 'fa0a7d81-a947-4bac-883d-952f6288f0a9', from instance: 'a192d603-0b8d-452f-aac3-f9e1f95e7411'...
OK
Deleted Key
fa0a7d81-a947-4bac-883d-952f6288f0a9
Passo 2- trigger l'errore creando un token di importazione, necessario per ripristinare il tasto e ripristinare la chiave, quindi ripristinare la chiave
# NOTE: the "kp key restore" requires an import token to complete the process,
# if you follow this example, the import token created above may still exist and
# the example works; otherwise, if the import token has expired then you need to
# create a new import token prior to restoring the key
# create an import token that expires in 15 minutes (900 seconds) and allows 10 retrievals
$ ibmcloud kp import-token create -e 900 -m 10
Created Expires Max Retrievals Remaining Retrievals
2020-08-18 19:12:35 +0000 UTC 2020-08-18 19:27:35 +0000 UTC 10 10
# extract the nonce that was created by the "kp import-token create" command
$ NONCE=$(ibmcloud kp import-token show | jq -r '.["nonce"]')
$ echo $NONCE
N3x8F0ihAZ51nj6M
# extract the public key that was created by the "kp import-token create" command
$ PUBLIC_KEY=$(ibmcloud kp import-token show | jq -r '.["payload"]')
$ echo $PUBLIC_KEY
LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0t ...<redacted>... QyBLRVktLS0tLQo=
# encrypt the key material using the public key
$ ibmcloud kp import-token key-encrypt -k $KEY_MATERIAL -p $PUBLIC_KEY
Encrypted Key
qkhpyERrqgU+q6M0ulCyFLP4/uAyTRNJ ...<redacted>... RvVRAyhPP9civbU=
# capture the encrypted key material
$ ENCRYPTED_KEY=qkhpyERrqgU+q6M0ulCyFLP4/uAyTRNJ ...<redacted>... RvVRAyhPP9civbU=
# encrypt the nonce
$ ibmcloud kp import-token nonce-encrypt -k $KEY_MATERIAL -n $NONCE
Encrypted Nonce IV
nrrCczvYXvc6T7J2G+EOLjHZO1cpPyu/nhsIlA== N6oLJnUqaKF3v5Sd
# Normally, you would capture the last encrypted nonce and the initialization
# vector (IV) (from the import token). Then use those new values with the
# "key restore" command.
# To force an error we are using the old (original) encrypted nonce and IV to
# restore the key, which fails because the ENCRYPTED_NONCE does not match the
# value in the import token
# we skipped these steps to force an error
# $ ENCRYPTED_NONCE=nrrCczvYXvc6T7J2G+EOLjHZO1cpPyu/nhsIlA==
# $ IV=N6oLJnUqaKF3v5Sd
# use the CLI to restore the deleted key
# this fails because the ENCRYPTED_NONCE does not match the value in the import token
$ ibmcloud kp key restore $KEY_ID -k $ENCRYPTED_KEY -n $ENCRYPTED_NONCE -v $IV --output json
FAILED
kp.Error:
correlation_id='a9412941-7986-421d-a67f-b22892e7634d',
msg='Bad Request:
Key could not be restored.
Please see `reasons` for more details.',
reasons='[INCORRECT_NONCE_ERR:
The encrypted nonce given does not match existing record,
please ensure the correct nonce was given in the request -
FOR_MORE_INFO_REFER: https://cloud.ibm.com/apidocs/key-protect]'
23 - Il token di importazione è scaduto
Messaggio
Il token di importazione è scaduto
Codice della ragione: IMPORT_TOKEN_SCADUTO _err
Codice di stato HTTP
409 - Conflitto
Il codice di stato della risposta HTTP 409 Conflict
indica un conflitto della richiesta con lo stato attuale del server stato attuale del server.
I conflitti sono più probabili in risposta a una richiesta PUT
. Ad esempio, è possibile ottenere una risposta 409
quando si caricano un file più vecchio di quello già presente sul server risultante in un conflitto
di controllo della versione.
Contesto
Esempio 1
Utilizzando l'API, creare un token di importazione, lasciarlo scadere, quindi tentare di recuperarlo.
# create an import token
$ curl -X POST \
"https://us-south.kms.cloud.ibm.com/api/v2/import_token" \
-H "authorization: Bearer $ACCESS_TOKEN" \
-H "bluemix-instance: $KP_INSTANCE_ID" \
-H "content-type: application/json" \
-d '{
"expiration": 300,
"maxAllowedRetrievals": 2
}'
risposta json
{
"maxAllowedRetrievals": 2,
"creationDate": "2020-08-18T19:54:57Z",
"expirationDate": "2020-08-18T19:59:57Z",
"remainingRetrievals":2
}
# retrieve the import token after it expires
$ curl -X GET \
"https://us-south.kms.cloud.ibm.com/api/v2/import_token" \
-H "authorization: Bearer $ACCESS_TOKEN" \
-H "bluemix-instance: $KP_INSTANCE_ID" \
-H "content-type: application/vnd.ibm.kms.import_token+json"
risposta json
{
"metadata": {
"collectionType": "application/vnd.ibm.kms.error+json",
"collectionTotal": 1
},
"resources": [
{
"errorMsg": "Conflict: Import Token could not be retrieved. Please see `reasons` for more details.",
"reasons":[
{
"code": "IMPORT_TOKEN_EXPIRED_ERR",
"message": "The import token has expired.",
"status": 409,
"moreInfo": "https://cloud.ibm.com/apidocs/key-protect"
}
]
}
]
}
Esempio 2
Utilizzando la CLI, creare un token di importazione, lasciarlo scadere, quindi tentare di recuperarlo.
# create an import token that expires in 5 minutes (300 seconds) and allows 2 retrievals
$ ibmcloud kp import-token create -e 300 -m 2
Created Expires Max Retrievals Remaining Retrievals
2020-08-18 19:39:06 +0000 UTC 2020-08-18 19:44:06 +0000 UTC 2 2
# sleep 300 seconds, which allows the import token to expire
$ sleep 300
# show the import token
$ ibmcloud kp import-token show
FAILED
kp.Error:
correlation_id='fb677c6e-9bfa-422e-a14b-0e221bbad32b',
msg='Conflict:
Import Token could not be retrieved.
Please see `reasons` for more details.',
reasons='[IMPORT_TOKEN_EXPIRED_ERR:
The import token has expired. -
FOR_MORE_INFO_REFER: https://cloud.ibm.com/apidocs/key-protect]'
24 - La chiave non può essere cancellata perché è ...
Messaggio
La chiave non può essere eliminata perché sta proteggendo una risorsa cloud che ha un criterio di conservazione: Prima di eliminare questa chiave, contattare il proprietario di un account per rimuovere il criterio di conservazione su ogni risorsa associata alla chiave
Codice della ragione: PREV_KEY_DEL_ERR
Codice di stato HTTP
409 - Conflitto
Il codice di stato della risposta HTTP 409 Conflict
indica un conflitto della richiesta con lo stato attuale del server stato attuale del server.
I conflitti sono più probabili in risposta a una richiesta PUT
. Ad esempio, è possibile ottenere una risposta 409
quando si caricano un file più vecchio di quello già presente sul server risultante in un conflitto
di controllo della versione.
Contesto
Questo errore si verifica quando viene cancellata una chiave, utilizzata per "Registrazioni".
Nella maggior parte dei casi, una chiave con le registrazioni può essere cancellata utilizzando --force
.
Se la risorsa registrata ha preventKeyDeletion
impostato su true
, allora una cancellazione forzata fallirà e verrà mostrata questa mesh di errore.
In altre parole, tutte le registrazioni devono avere preventKeyDeletion
impostato su false
.
Le registrazioni sono associazioni tra chiavi di root e altre risorse cloud, come le buste Cloud Object Storage (COS) o Cloud Databases distribuzioni.
Per ulteriori informazioni sulle Registrazioni, consultare visualizzazione delle associazioni tra le chiavi di root e le risorse IBM Cloud crittografate.
25 - La chiave non è dual auth abilitata e ...
Messaggio
La chiave non è abilitata alla doppia autenticazione e non può essere impostata per la cancellazione
Codice della ragione: NOT_DUAL_AUTH_ERR
Codice di stato HTTP
409 - Conflitto
Il codice di stato della risposta HTTP 409 Conflict
indica un conflitto della richiesta con lo stato attuale del server stato attuale del server.
I conflitti sono più probabili in risposta a una richiesta PUT
. Ad esempio, è possibile ottenere una risposta 409
quando si caricano un file più vecchio di quello già presente sul server risultante in un conflitto
di controllo della versione.
Contesto
Questo errore si verifica quando si cerca di autorizzare una cancellazione o rimuovere un'autorizzazione e la chiave non ha una politica dual authorization
.
Questi esempi mostrano l'errore utilizzando l'API e la CLI.
Esempio 1
Questo esempio tenta di autorizzare una cancellazione e rimuovere un'autorizzazione tramite l'API.
# create a root key
$ curl -X POST \
"https://us-south.kms.cloud.ibm.com/api/v2/keys" \
-H "authorization: Bearer $ACCESS_TOKEN" \
-H "bluemix-instance: $KP_INSTANCE_ID" \
-H "content-type: application/vnd.ibm.kms.key+json" \
-d '{
"metadata": {
"collectionType": "application/vnd.ibm.kms.key+json",
"collectionTotal": 1
},
"resources": [
{
"type": "application/vnd.ibm.kms.key+json",
"name": "root-example-key",
"description": "root-example-key",
"extractable": false
}
]
}'
risposta json
{
"metadata": {
"collectionType": "application/vnd.ibm.kms.key+json",
"collectionTotal": 1
},
"resources": [
{
"type": "application/vnd.ibm.kms.key+json",
"id": "eb086d96-3b2c-48b5-bf31-c8f0305eea77",
"name": "root-example-key",
"description": "root-example-key",
"state": 1,
"extractable": false,
"crn":"crn:v1:bluemix:public:kms:us-south:a/ea998d3389c3473aa0987652b46fb146:a192d603-0b8d-452f-aac3-f9e1f95e7411:key:eb086d96-3b2c-48b5-bf31-c8f0305eea77",
"imported": false,
"deleted": false
}
]
}
Autorizzare l'eliminazione per una chiave con una polizza di autorizzazione duplice.
# set the KEY_ID
$ KEY_ID=eb086d96-3b2c-48b5-bf31-c8f0305eea77
# this request fails because the key DOES NOT have a dual authorization policy
$ curl -X POST \
"https://us-south.kms.cloud.ibm.com/api/v2/keys/$KEY_ID/actions/setKeyForDeletion" \
-H "authorization: Bearer $ACCESS_TOKEN" \
-H "bluemix-instance: $KP_INSTANCE_ID" \
-H "content-type: application/vnd.ibm.kms.key_action+json"
risposta json
{
"metadata": {
"collectionType": "application/vnd.ibm.kms.error+json",
"collectionTotal": 1
},
"resources": [
{
"errorMsg": "Conflict: Action could not be performed on key. Please see `reasons` for more details.",
"reasons": [
{
"code": "NOT_DUAL_AUTH_ERR",
"message":"The key is not dual auth enabled and cannot be set for deletion",
"status": 409,
"moreInfo": "https://cloud.ibm.com/apidocs/key-protect"
}
]
}
]
}
Rimuovere un'autorizzazione per una chiave con una polizza di autorizzazione duplice.
# this request fails because the key DOES NOT have a dual authorization policy
$ curl -X POST \
"https://us-south.kms.cloud.ibm.com/api/v2/keys/$KEY_ID/actions/unsetKeyForDeletion" \
-H "authorization: Bearer $ACCESS_TOKEN" \
-H "bluemix-instance: $KP_INSTANCE_ID" \
-H "content-type: application/vnd.ibm.kms.key_action+json"
risposta json
{
"metadata": {
"collectionType": "application/vnd.ibm.kms.error+json",
"collectionTotal": 1
},
"resources": [
{
"errorMsg": "Conflict: Action could not be performed on key. Please see `reasons` for more details.",
"reasons": [
{
"code": "NOT_DUAL_AUTH_ERR",
"message": "The key is not dual auth enabled and cannot be set for deletion",
"status": 409,
"moreInfo": "https://cloud.ibm.com/apidocs/key-protect"
}
]
}
]
}
Esempio 2
Questo esempio tenta di autorizzare una cancellazione e rimuovere un'autorizzazione utilizzando CLI.
Nota: il $KEY_ID
è stato impostato nell'esempio precedente.
# this request fails because the key DOES NOT have a dual authorization policy
$ ibmcloud kp key schedule-delete $KEY_ID
Scheduling key for deletion...
FAILED
kp.Error:
correlation_id='3d941968-c599-43b3-b681-306422079412',
msg='Conflict:
Action could not be performed on key.
Please see `reasons` for more details.',
reasons='[NOT_DUAL_AUTH_ERR:
The key is not dual auth enabled and cannot be set for deletion -
FOR_MORE_INFO_REFER: https://cloud.ibm.com/apidocs/key-protect]'
# this request fails because the key DOES NOT have a dual authorization policy
$ ibmcloud kp key cancel-delete $KEY_ID
Cancelling key for deletion...
FAILED
kp.Error:
correlation_id='5b04a667-573c-44d1-82d5-39730af56a75',
msg='Conflict:
Action could not be performed on key.
Please see `reasons` for more details.',
reasons='[NOT_DUAL_AUTH_ERR:
The key is not dual auth enabled and cannot be set for deletion -
FOR_MORE_INFO_REFER: https://cloud.ibm.com/apidocs/key-protect]'
26 - La chiave è stata aggiornata di recente
Messaggio
La chiave è stata aggiornata di recente: Attendere e riprovare
Codice motivo: REQ_TOO_EARLY_ERR
Codice di stato HTTP
409 - Conflitto
Il codice di stato della risposta HTTP 409 Conflict
indica un conflitto della richiesta con lo stato attuale del server stato attuale del server.
I conflitti sono più probabili in risposta a una richiesta PUT
. Ad esempio, è possibile ottenere una risposta 409
quando si caricano un file più vecchio di quello già presente sul server risultante in un conflitto
di controllo della versione.
Contesto
Questo errore si verifica quando si enable
o restore
una chiave entro 30 seconds secondi dall'ultima azione.
È necessario attendere almeno 30 seconds minuti tra l'ultima "azione" e l'abilitazione o il ripristino di una chiave.
Questo esempio fallisce perché la chiave è stata abilitata troppo presto dopo la disabilitazione di una chiave.
# create a root key
$ KEY_ID=$(ibmcloud kp key create example-key -i $KP_INSTANCE_ID --output json | jq -r '.["id"]')
$ echo $KEY_ID
54f53384-b563-4466-860a-c42ce42f7ac9
# disable the key
$ ibmcloud kp key disable $KEY_ID -i $KP_INSTANCE_ID
Disabling key: '54f53384-b563-4466-860a-c42ce42f7ac9', in instance: 'a192d603-0b8d-452f-aac3-f9e1f95e7411'...
OK
# this request fails because the key was enabled too soon
$ ibmcloud kp key enable $KEY_ID -i $KP_INSTANCE_ID
Enabling key: '54f53384-b563-4466-860a-c42ce42f7ac9', in instance: 'a192d603-0b8d-452f-aac3-f9e1f95e7411'...
FAILED
kp.Error:
correlation_id='59c343a7-c20f-43ea-9e50-da45cecbc8a6',
msg='Conflict:
Key could not be enabled.
Please see `reasons` for more details.',
reasons='[REQ_TOO_EARLY_ERR:
The key was updated recently.
Please wait and try again. -
FOR_MORE_INFO_REFER: https://cloud.ibm.com/apidocs/key-protect]'
# this request succeeds because the key was disabled at least 30 seconds ago
$ ibmcloud kp key enable $KEY_ID -i $KP_INSTANCE_ID
Enabling key: '54f53384-b563-4466-860a-c42ce42f7ac9', in instance: 'a192d603-0b8d-452f-aac3-f9e1f95e7411'...
OK
27 - Il testo cifrato fornito non è valido o ...
Messaggio
Il testo cifrato fornito non è valido o è corrotto
Codice motivo: UNPROCESSABLE_CIPHERTEXT_ERR
Codice di stato HTTP
422 - Entità non processabile
Il codice di stato della risposta HTTP 422 Unprocessable Entity
indica che il il server comprende il tipo di contenuto dell'entità richiesta e la sintassi dell'entità richiesta è corretta richiesta è corretta, ma non è stato in
grado di elaborare le istruzioni contenute istruzioni contenute.
Il client non deve ripetere questa richiesta senza modificazioni.
Contesto
Questo in genere significa che il modulo di sicurezza hardware (HSM) non ha potuto elaborare i dati in quanto l'input non era valido.
Questo errore viene restituito quando c'è un errore interno.
Se si ottiene questo errore si prega di contattare IBM supporto
28 - Il nonce criptato fornito non era ...
Messaggio
Il nonce criptato fornito non è stato criptato con il materiale chiave fornito OPPURE il IV fornito non corrisponde al nonce crittografato
Codice motivo: INCORRECT_NONCE_IV_ERR
Codice di stato HTTP
400 - Bad Request
Il codice di stato della risposta HTTP 400 Bad Request
indica che il server non può o non elaborerà la richiesta a causa di qualcosa che viene percepito come un errore del cliente (ad es errore del client (ad esempio, sintassi
della richiesta malformata, inquadramento del messaggio di richiesta non valido o instradamento ingannevole della richiesta), o instradamento ingannevole della richiesta).
Il client non deve ripetere questa richiesta senza modificazioni.
Contesto
Questo in genere significa che il modulo di sicurezza hardware (HSM) non ha potuto elaborare i dati in quanto l'input non era valido.
Questo errore viene restituito quando c'è un errore interno.
Se si ottiene questo errore si prega di contattare IBM supporto
29 - La risorsa o le risorse interrogate non appartengono al servizio
Messaggio
La risorsa o le risorse interrogate non appartengono al servizio
Codice motivo: RESOURCE_OWNER_ERR
Codice di stato HTTP
403 - Vietato
Il codice di risposta allo stato di errore del client HTTP 403 Forbidden
indica che il server ha compreso la richiesta ma rifiuta di autorizzarla server ha compreso la richiesta ma si rifiuta di autorizzarla.
Questo stato è simile a 401
, ma in questo caso, ri - autenticarsi non farà alcuna differenza. L'accesso è permanentemente vietato e legato alla logica applicativa, come i diritti insufficienti ad una risorsa.
Contesto
Questo messaggio di errore si verifica in una richiesta service - to - service. Il servizio tenta di eliminare una chiave, che non è consentita. Ovvero, un altro servizio non può cancellare un Key Protect chiave.
Un esempio di utilizzo dell'accesso service - to - service è un utente che sta configurando un bucket COS ( Cloud Object Storage ) per crittografare i propri dati utilizzando un Key Protect chiave.
Utilizzando l'esempio COS, COS non può cancellare la chiave utilizzata per cifrare i dati.
30 - Questa azione può essere effettuata solo da un servizio ...
Messaggio
Questa azione può essere eseguita solo da un servizio (da servizio a servizio)
Codice motivo: SERVICE_ONLY_ERR
Codice di stato HTTP
403 - Vietato
Il codice di risposta allo stato di errore del client HTTP 403 Forbidden
indica che il server ha compreso la richiesta ma rifiuta di autorizzarla server ha compreso la richiesta ma si rifiuta di autorizzarla.
Questo stato è simile a 401
, ma in questo caso, ri - autenticarsi non farà alcuna differenza. L'accesso è permanentemente vietato e legato alla logica applicativa, come i diritti insufficienti ad una risorsa.
Contesto
Alcune azioni, come la creazione di una "registrazione", possono essere eseguite solo da un altro servizio, in quella che è nota come richiesta servizio - service.
Ad esempio, se si configura un bucket Cloud Object Storage (COS) per crittografare i dati utilizzando un tasto Key Protect, allora il servizio COS deve creare la registrazione.
Una richiesta service - to - service è necessaria per creare, cancellare, sostituire o aggiornare una registrazione.
Per ulteriori informazioni sulle registrazioni, consultare queste risorse.
31 - Questa azione non è consentita su questo ...
Messaggio
Questa azione non è consentita su questa risorsa: Contattare IBM Key Protect o aprire un ticket di assistenza per abilitare questa funzione
Codice della ragione: FEATURE_RESTRITED_ERR
Codice di stato HTTP
403 - Vietato
Il codice di risposta allo stato di errore del client HTTP 403 Forbidden
indica che il server ha compreso la richiesta ma rifiuta di autorizzarla server ha compreso la richiesta ma si rifiuta di autorizzarla.
Questo stato è simile a 401
, ma in questo caso, ri - autenticarsi non farà alcuna differenza. L'accesso è permanentemente vietato e legato alla logica applicativa, come i diritti insufficienti ad una risorsa.
Contesto
Si sta tentando di creare, aggiornare o utilizzare una policy di istanza con una funzione non supportata.
Ad esempio, la policy di istanza è stata creata per una gamma di indirizzi allowedIp
, che supporta solo gli indirizzi IPv4. Hai poi fatto una richiesta all'istanza con un Indirizzo IPv6, che restituisce questo errore.
32 - Questa richiesta richiede che la versione chiave ...
Messaggio
Questa richiesta richiede che la versione della chiave sia successiva alla versione corrente della chiave di versione della chiave di registrazione
Codice motivo: KEY_VERSION_VALIDO
Codice di stato HTTP
422 - Entità non processabile
Il codice di stato della risposta HTTP 422 Unprocessable Entity
indica che il il server comprende il tipo di contenuto dell'entità richiesta e la sintassi dell'entità richiesta è corretta richiesta è corretta, ma non è stato in
grado di elaborare le istruzioni contenute istruzioni contenute.
Il client non deve ripetere questa richiesta senza modificazioni.
Contesto
Questo errore si applica ai tasti utilizzati per "Registrazioni".
Quando un servizio, come Cloud Object Storage (COS), cerca di sostituire o ripristinare una chiave controlla la registrazione data / ora della chiave.
Se la data / ora chiave è inferiore alla registrazione data / ora del tasto utilizzato dalla registrazione, si verifica questo errore.
Il tasto utilizzato per l'acquisto del servizio deve avere una registrazione data / ora uguale o superiore alla chiave di registrazione.
Le registrazioni sono associazioni tra chiavi di root e altre risorse cloud, come le buste Cloud Object Storage (COS) o Cloud Databases distribuzioni.
Per ulteriori informazioni sulle Registrazioni, consultare visualizzazione delle associazioni tra le chiavi di root e le risorse IBM Cloud crittografate.
33 - Questo tasto root è stato ruotato all'interno di ...
Messaggio
Questa chiave di root è stata ruotata all'interno dell'ultima ora: Solo una 'ruota' azione all'ora è consentita
Codice della ragione: KEY_ROTATION_NOT_CONSENTITO
Codice di stato HTTP
409 - Conflitto
Il codice di stato della risposta HTTP 409 Conflict
indica un conflitto della richiesta con lo stato attuale del server stato attuale del server.
I conflitti sono più probabili in risposta a una richiesta PUT
. Ad esempio, è possibile ottenere una risposta 409
quando si caricano un file più vecchio di quello già presente sul server risultante in un conflitto
di controllo della versione.
Contesto
Un tasto root può essere ruotato, al massimo, una volta all'ora. Tentando di ruotare un tasto root qualsiasi prima di un'ora restituisce questo messaggio di errore.
# step 1 - create a root key and provide a key material
$ KEY_MATERIAL=$(openssl rand -base64 32)
$ echo $KEY_MATERIAL
dlYulSKD5cEG/XoAV8vv4QiQe/s3SlBzPY+PKgq92/0=
$ KEY_ID=$(ibmcloud kp key create rotate-example-key -i $KP_INSTANCE_ID --key-material $KEY_MATERIAL --output json | jq -r '.["id"]')
$ echo $KEY_ID
1604b4f3-6ba0-459c-8f65-400ed981a5eb
# step 2 - this request succeeds because there is no time
# restriction when rotating the key the first time
$ KEY_MATERIAL_NEW_1=$(openssl rand -base64 32)
$ echo $KEY_MATERIAL_NEW_1
rK9CCRHxr8RpVvKQSEvud1zHAPnXl3PvhaPwx2aRxGE=
$ curl -X POST \
"https://us-south.kms.cloud.ibm.com/api/v2/keys/$KEY_ID/actions/rotate" \
-H "authorization: Bearer $ACCESS_TOKEN" \
-H "bluemix-instance: $KP_INSTANCE_ID" \
-H "content-type: application/vnd.ibm.kms.key_action+json" \
-d '{
"payload": "'$KEY_MATERIAL_NEW_1'"
}'
# step 3 - this request fails because the key was
# last rotated less than one hour ago
$ KEY_MATERIAL_NEW_2=$(openssl rand -base64 32)
$ echo $KEY_MATERIAL_NEW_2
pQX+ghaaH/r/s54ICWuwq3jQDPWlHQMDhAV0mwpBf2w=
$ curl -X POST \
"https://us-south.kms.cloud.ibm.com/api/v2/keys/$KEY_ID/actions/rotate" \
-H "authorization: Bearer $ACCESS_TOKEN" \
-H "bluemix-instance: $KP_INSTANCE_ID" \
-H "content-type: application/vnd.ibm.kms.key_action+json" \
-d '{
"payload": "'$KEY_MATERIAL_NEW_2'"
}'
risposta json
{
"metadata": {
"collectionType": "application/vnd.ibm.kms.error+json",
"collectionTotal": 1
},
"resources": [
{
"errorMsg": "Conflict: Action could not be performed on key: Please see `reasons` for more details (KEY_ROTATION_NOT_PERMITTED)",
"reasons": [
{
"code": "KEY_ROTATION_NOT_PERMITTED",
"message": "This root key has been rotated within the last hour: Only one 'rotate' action per hour is permitted",
"status": 409,
"moreInfo": "https://cloud.ibm.com/apidocs/key-protect"
}
]
}
]
}
34 - Questo tasto root è stato creato con l'utente fornito ...
Messaggio
Questa chiave principale è stata creata con il materiale della chiave fornito dall'utente: Il materiale della chiave è necessario per eseguire un'azione di "rotazione"
Codice motivo: KEY_PAYLOAD_REQ_ERR
Codice di stato HTTP
400 - Bad Request
Il codice di stato della risposta HTTP 400 Bad Request
indica che il server non può o non elaborerà la richiesta a causa di qualcosa che viene percepito come un errore del cliente (ad es errore del client (ad esempio, sintassi
della richiesta malformata, inquadramento del messaggio di richiesta non valido o instradamento ingannevole della richiesta), o instradamento ingannevole della richiesta).
Il client non deve ripetere questa richiesta senza modificazioni.
Contesto
Se un tasto root è stato creato con un materiale chiave (payload), allora deve essere specificato un materiale chiave per ruotare la chiave.
# step 1 - create a root key and provide a key material
$ KEY_MATERIAL=$(openssl rand -base64 32)
$ echo $KEY_MATERIAL
HpHM2YG9PMLBo4fZmV2WODZTTWlwaKmy496MoCE7w7U=
$ KEY_ID=$(ibmcloud kp key create rotate-example-key -i $KP_INSTANCE_ID --key-material $KEY_MATERIAL --output json | jq -r '.["id"]')
$ echo $KEY_ID
e52ee578-af71-4cd7-ba19-f1a8020d6a10
# step 2 - rotate the key without a new key material
$ curl -X POST \
"https://us-south.kms.cloud.ibm.com/api/v2/keys/$KEY_ID/actions/rotate" \
-H "authorization: Bearer $ACCESS_TOKEN" \
-H "bluemix-instance: $KP_INSTANCE_ID" \
-H "content-type: application/vnd.ibm.kms.key_action+json"
risposta json
{
"metadata": {
"collectionType": "application/vnd.ibm.kms.error+json",
"collectionTotal": 1
},
"resources": [
{
"errorMsg": "Bad Request: Action could not be performed on key: Please see `reasons` for more details (KEY_PAYLOAD_REQ_ERR)",
"reasons": [
{
"code": "KEY_PAYLOAD_REQ_ERR",
"message": "This root key was created with user-supplied key material: Key material is required to perform a 'rotate' action",
"status": 400,
"moreInfo": "https://cloud.ibm.com/apidocs/key-protect",
"target": {
"type": "field",
"name": "payload"
}
}
]
}
]
}
Ordinati per codice di stato HTTP
Questi sono i messaggi di errore ordinati per codice stato HTTP.
HTTP 400 - Richiesta errata
-
Il totale della raccolta non corrisponde al numero di risorse - dettagli
-
I dati nel corpo non corrispondono a quelli richiesti dal parametro della query dettagli
-
L'estrazione dell'oggetto dal token del portatore non è riuscita: Assicurarsi che il token del portatore sia quello corretto (e nel formato corretto) e che possa eseguire le azioni richieste azioni richieste - dettagli
-
Sono stati passati dati del corpo non validi: Assicurarsi che i dati passati abbiano una formattazione formattazione valida senza caratteri non validi - dettagli
-
Errore di campo non valido: per il wrap
The field 'plaintext' must be: a base64 encoded key material
se viene passato un testo in chiaro non valido nella richiesta; eThe field 'ciphertext' must be: the original base64 encoded ciphertext from the wrap operation
per unwrap se viene superato il testo cifrato non valido. - dettagli -
Il ripristino della chiave è scaduto - dettagli
-
Corpo mancante nella richiesta - dettagli
-
Per ogni parametro della query può essere creato un solo criterio di istanza: Passare oggetto risorsa singolo - dettagli
-
È possibile ripristinare solo le chiavi importate dettagli
-
L'azione richiesta può essere completata solo con una chiave di root dettagli
-
Non è stato possibile eseguire l'azione sulla chiave perché la chiave è scaduta dettagli
-
Il nonce criptato fornito non corrisponde al record esistente: Assicurarsi che il nonce corretto sia stato fornito nella richiesta - dettagli
-
Il nonce criptato fornito non è stato criptato con il materiale chiave fornito OPPURE l'IV fornito non corrisponde al nonce criptato - dettagli
-
Questa chiave principale è stata creata con il materiale della chiave fornito dall'utente: Il materiale della chiave è necessario per eseguire un'azione di "rotazione" - dettagli
HTTP 401 - Non autorizzato
- Non autorizzato: L'utente non ha accesso alla risorsa specificata dettagli
HTTP 403 - Vietato
-
La modifica richiesta non è conforme alle regole di configurazione dettagli
-
La risorsa o le risorse interrogate non appartengono al servizio dettagli
-
Questa azione può essere eseguita solo da un servizio (da servizio a servizio) dettagli
-
Questa azione non è consentita su questa risorsa: Contattare IBM Key Protect o aprire un ticket di assistenza per abilitare questa funzione - dettagli
HTTP 409 - Conflitto
-
La chiave non è in uno stato valido - dettagli
-
La chiave è la protezione di una o più risorse cloud dettagli
-
Il criterio dell'istanza KeyCreateImportAccess non consente questa azione dettagli
-
Il numero di autorizzazioni necessarie per l'eliminazione non è stato raggiunto dettagli
-
Il token di importazione è scaduto - dettagli
-
La chiave non può essere eliminata perché protegge una risorsa cloud che ha un criterio di conservazione politica di conservazione: Prima di eliminare questa chiave, contattare il proprietario dell'account per rimuovere il criterio di conservazione su ogni risorsa associata alla chiave dettagli
-
La chiave non è abilitata alla doppia autenticazione e non può essere impostata per la cancellazione dettagli
-
La chiave è stata aggiornata di recente: Attendere e riprovare - dettagli
-
Questa chiave principale è stata ruotata nell'ultima ora: È consentita una sola azione di "rotazione per ora è consentita - dettagli
HTTP 410 - Sparito
- La chiave è già stata cancellata: Si prega di cancellare i riferimenti a questa chiave - dettagli
HTTP 422 - Entità non elaborabile
-
La chiave non è in uno stato valido - dettagli
-
L'azione richiesta può essere completata solo con una chiave di root dettagli
-
La firma non è valida dettagli
-
Il testo cifrato fornito non è valido o è corrotto dettagli
-
Questa richiesta richiede che la versione della chiave sia successiva alla registrazione corrente versione chiave - dettagli
HTTP 500 - Errore interno del server
- I metadati della chiave sono stati danneggiati: Si prega di cancellare questa chiave - dettagli
Ordinato per codice motivo
Questa sezione ordina i messaggi di errore dal codice della ragione.
- AUTIZATIONS_NOT_MET - dettagli
- BAD_BODY_ERR - dettagli
- BEARER_SUB_EXTRACTION_ERR - dettagli
- BODY_QUERY_PARAM_MISMATCH_ERR - dettagli
- COLLECTION_TOTAL_MISMATCH_ERR - dettagli
- CONFIG_RULE_CONFLT_ERR dettagli
- FEATURE_RESTRITED_ERR - dettagli
- IMPORT_TOKEN_SCADUTO _err - dettagli
- INCOMPLETE_METADATA_ERR - dettagli
- INCORRECT_NONCE_ERR - dettagli
- INCORRECT_NONCE_IV_ERR - dettagli
- INVALID_FIELD_ERR - dettagli
- INVALID_SIG_EXP_ERR dettagli
- KEY_ACTION_INVALID_STATE_ERR - dettagli
- KEY_CREATE_IMPORT_ACCESS_ERR - dettagli
- KEY_DELETED_ERR - dettagli
- KEY_EXPIRED_ERR - dettagli
- KEY_IMPT_REQ_ERR - dettagli
- KEY_INVALID_STATE_ERR - dettagli
- KEY_PAYLOAD_REQ_ERR - dettagli
- KEY_RIPRISTINE_SCADUTO - dettagli
- KEY_ROOT_REQ_ERR - dettagli
- KEY_ROOT_REQ_REG_ERR - dettagli
- KEY_ROTATION_NOT_CONSENTITO - dettagli
- KEY_VERSION_NON valido - dettagli
- NO_BODY_ERR - dettagli
- NOT_DUAL_AUTH_ERR - dettagli
- NUM_COLLECTION_RESOURCE_ERR - dettagli
- PREV_KEY_DEL_ERR - dettagli
- PROTECTED_RESOURCE_ERR - dettagli
- REQ_TOO_EARLY_ERR - dettagli
- RESOURCE_OWNER_ERR - dettagli
- SERVICE_ONLY_ERR - dettagli
- UNAUTIZED_ERR - dettagli
- UNPROCESSABLE_CIPHERTEXT_ERR - dettagli