Encrypt
    • PDF

    Encrypt

    • PDF

    Article summary

    Summary

    Up to 32 KB data are encrypted with the current version of the specified master key. The request can only be made with the key type used for encryption and decryption.

    POST https://kms.apigw.ntruss.com/keys/v1/{keyTag}/encrypt
    POST https://kms.apigw.ntruss.com/keys/v2/{keyTag}/encrypt
    

    Request

    Request parameters

    Parameter nameTypeDescription
    keyTagString (Required)Tag value of the master key to use for the encryption

    Request body

    {
      "plaintext" : string or string list,
      "context" : string
    }
    
    Parameter nameTypeDescription
    plaintextString or String List (Required)- Data to encrypt (up to 32 KB)
    Need to be Base64-encoded
    List can be up to 32 KB for all items combined
    contextString (Optional)- Context data (up to 50 bytes)
    Need to be Base64-encoded
    Required only for AES-256 key type with convergent encryption

    Request body example

    {
      "plaintext" : "dGVzdA==",
      "context" : "dGhpcyBpcyBhIHRlc3QgY29udGV4dA=="
    }
    or
    {
      "plaintext" : ["dGVzdA==", "dGVzdDI=", "dGVzdDM="],
      "context" : "dGhpcyBpcyBhIHRlc3QgY29udGV4dA=="
    }
    

    Response

    Response body

    {
      "ciphertext" : string
    }
    or 
    {
      "ciphertextList" : [string, string, string]
    }
    
    Parameter nameTypeDescription
    ciphertextString- Ciphertext data
    Consist of a KMS prefix and a Base64-encoded ciphertext
    Returned if requested as a string type
    ciphertextListString List- Ciphertext data
    Consist of a KMS prefix and a Base64-encoded ciphertext
    Returned if requested as a string list type

    Was this article helpful?

    What's Next
    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.