Update marcellanz/transit_pkcs1v15 RSA encryption support (#25486)

* [transit-pkcs1v15] transit support for the pkcs1v15 padding scheme – without UI tests (yet).

* [transit-pkcs1v15] renamed padding_scheme parameter in transit documentation.

* [transit-pkcs1v15] add changelog file.

* [transit-pkcs1v15] remove the algorithm path as padding_scheme is chosen by parameter.

* Update ui/app/templates/components/transit-key-action/datakey.hbs

Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com>

* Update ui/app/templates/components/transit-key-action/datakey.hbs

Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com>

* Update ui/app/templates/components/transit-key-action/datakey.hbs

Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com>

* Update website/content/api-docs/secret/transit.mdx

Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com>

* Update website/content/api-docs/secret/transit.mdx

Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com>

* Update website/content/api-docs/secret/transit.mdx

Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com>

* Add warnings to PKCS1v1.5 usage

* Update transit

* Update transit, including separating encrypt/decrypt paddings for rewrap

* Clean up factory use in the presence of padding

* address review feedback

* remove defaults

* lint

* more lint

* Some fixes for UI issues

 - Fix padding scheme dropdown console error by adding values
   to the transit-key-actions.hbs
 - Populate both padding scheme drop down menus within rewrap,
   not just the one padding_scheme
 - Do not submit a padding_scheme value through POST for non-rsa keys

* Fix Transit rewrap API to use decrypt_padding_scheme, encrypt_padding_scheme

 - Map the appropriate API fields for the RSA padding scheme to the
   batch items within the rewrap API
 - Add the ability to create RSA keys within the encrypt API endpoint
 - Add test case for rewrap api that leverages the padding_scheme fields

* Fix code linting issues

* simply padding scheme enum

* Apply suggestions from code review

Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com>

* Fix padding_scheme processing on data key api

 - The data key api was using the incorrect parameter name for
   the padding scheme
 - Enforce that padding_scheme is only used on RSA keys, we
   are punting on supporting it for managed keys at the moment.

* Add tests for parsePaddingSchemeArg

* Add missing copywrite headers

* Some small UI fixes

* Add missing param to datakey in api-docs

* Do not send padding_scheme for non-RSA key types within UI

* add UI tests for transit key actions form

---------

Co-authored-by: Marcel Lanz <marcellanz@n-1.ch>
Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com>
Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com>
Co-authored-by: Steve Clark <steven.clark@hashicorp.com>
Co-authored-by: claire bontempo <cbontempo@hashicorp.com>
This commit is contained in:
Scott Miller
2024-10-09 09:30:14 -05:00
committed by GitHub
parent 770d902f60
commit 3c0656e4c4
20 changed files with 949 additions and 104 deletions

View File

@@ -797,6 +797,16 @@ will be returned.
data (also known as additional data or AAD) to also be authenticated with
AEAD ciphers (`aes128-gcm96`, `aes256-gcm`, and `chacha20-poly1305`).
- `padding_scheme` `(string: "oaep")` Specifies the RSA encryption padding
scheme for RSA keys. Must be one of the following supported signature types:
- `oaep`
- `pkcs1v15`
~> **Warning:** `pkcs1v15` is a legacy padding scheme with security weaknesses.
It is recommended that the default of OAEP be used unless specific backwards
compatibility is required.
- `context` `(string: "")`  Specifies the **base64 encoded** context for key
derivation. This is required if key derivation is enabled for this key.
@@ -922,6 +932,12 @@ This endpoint decrypts the provided ciphertext using the named key.
data (also known as additional data or AAD) to also be authenticated with
AEAD ciphers (`aes128-gcm96`, `aes256-gcm`, and `chacha20-poly1305`).
- `padding_scheme` `(string: "oaep")` Specifies the RSA decryption padding
scheme for RSA keys. Must be one of the following supported signature types:
- `oaep`
- `pkcs1v15`
- `context` `(string: "")` Specifies the **base64 encoded** context for key
derivation. This is required if key derivation is enabled.
@@ -1008,6 +1024,22 @@ functionality to untrusted users or scripts.
- `ciphertext` `(string: <required>)`  Specifies the ciphertext to re-encrypt.
- `decrypt_padding_scheme` `(string: "oaep")` Specifies the RSA padding
scheme for RSA keys for the decrypt step. Must be one of the following supported signature types:
- `oaep`
- `pkcs1v15`
- `encrypt_padding_scheme` `(string: "oaep")` Specifies the RSA padding
scheme for RSA keys for the encrypt step. Must be one of the following supported signature types:
- `oaep`
- `pkcs1v15`
~> **Warning:** `pkcs1v15` is a legacy padding scheme with security weaknesses.
It is recommended that the default of OAEP be used unless specific backwards
compatibility is required.
- `context` `(string: "")` Specifies the **base64 encoded** context for key
derivation. This is required if key derivation is enabled.
@@ -1109,6 +1141,16 @@ then made available to trusted users.
- `bits` `(int: 256)`  Specifies the number of bits in the desired key. Can be
128, 256, or 512.
- `padding_scheme` `(string: "oaep")` Specifies the RSA encryption padding
scheme for RSA keys. Must be one of the following supported signature types:
- `oaep`
- `pkcs1v15`
~> **Warning:** `pkcs1v15` is a legacy padding scheme with security weaknesses.
It is recommended that the default of OAEP be used unless specific backwards
compatibility is required.
### Sample payload
```json