open-vault/builtin/logical/transit
Gabriel Santos 05f3236c15
Provide public key encryption via transit engine (#17934)
* import rsa and ecdsa public keys

* allow import_version to update public keys - wip

* allow import_version to update public keys

* move check key fields into func

* put private/public keys in same switch cases

* fix method in UpdateKeyVersion

* move asymmetrics keys switch to its own method - WIP

* test import public and update it with private counterpart

* test import public keys

* use public_key to encrypt if RSAKey is not present and failed to decrypt
if key version does not have a private key

* move key to KeyEntry parsing from Policy to KeyEntry method

* move extracting of key from input fields into helper function

* change back policy Import signature to keep backwards compatibility and
add new method to import private or public keys

* test import with imported public rsa and ecdsa keys

* descriptions and error messages

* error messages, remove comments and unused code

* changelog

* documentation - wip

* suggested changes - error messages/typos and unwrap public key passed

* fix unwrap key error

* fail if both key fields have been set

* fix in extractKeyFromFields, passing a PolicyRequest wouldn't not work

* checks for read, sign and verify endpoints so they don't return errors when a private key was not imported and tests

* handle panic on "export key" endpoint if imported key is public

* fmt

* remove 'isPrivateKey' argument from 'UpdateKeyVersion' and
'parseFromKey' methods

also: rename 'UpdateKeyVersion' method to 'ImportPrivateKeyForVersion' and 'IsPublicKeyImported' to 'IsPrivateKeyMissing'

* delete 'RSAPublicKey' when private key is imported

* path_export: return public_key for ecdsa and rsa when there's no private key imported

* allow signed data validation with pss algorithm

* remove NOTE comment

* fix typo in EC public key export where empty derBytes was being used

* export rsa public key in pkcs8 format instead of pkcs1 and improve test

* change logic on how check for is private key missing is calculated

---------

Co-authored-by: Alexander Scheel <alex.scheel@hashicorp.com>
2023-05-11 11:56:46 +00:00
..
cmd/transit adding copyright header (#19555) 2023-03-15 09:00:52 -07:00
backend.go openapi: Add display attributes for transit plugin (#19575) 2023-04-10 14:20:53 -04:00
backend_test.go Provide public key encryption via transit engine (#17934) 2023-05-11 11:56:46 +00:00
managed_key_util.go adding copyright header (#19555) 2023-03-15 09:00:52 -07:00
path_backup.go openapi: Add display attributes for transit plugin (#19575) 2023-04-10 14:20:53 -04:00
path_backup_test.go adding copyright header (#19555) 2023-03-15 09:00:52 -07:00
path_cache_config.go openapi: Add display attributes for transit plugin (#19575) 2023-04-10 14:20:53 -04:00
path_cache_config_test.go adding copyright header (#19555) 2023-03-15 09:00:52 -07:00
path_config_keys.go openapi: Add display attributes for transit plugin (#19575) 2023-04-10 14:20:53 -04:00
path_config_keys_test.go adding copyright header (#19555) 2023-03-15 09:00:52 -07:00
path_datakey.go openapi: Add display attributes for transit plugin (#19575) 2023-04-10 14:20:53 -04:00
path_decrypt.go openapi: Add display attributes for transit plugin (#19575) 2023-04-10 14:20:53 -04:00
path_decrypt_bench_test.go adding copyright header (#19555) 2023-03-15 09:00:52 -07:00
path_decrypt_test.go adding copyright header (#19555) 2023-03-15 09:00:52 -07:00
path_encrypt.go openapi: Add display attributes for transit plugin (#19575) 2023-04-10 14:20:53 -04:00
path_encrypt_bench_test.go adding copyright header (#19555) 2023-03-15 09:00:52 -07:00
path_encrypt_test.go Provide public key encryption via transit engine (#17934) 2023-05-11 11:56:46 +00:00
path_export.go Provide public key encryption via transit engine (#17934) 2023-05-11 11:56:46 +00:00
path_export_test.go adding copyright header (#19555) 2023-03-15 09:00:52 -07:00
path_hash.go openapi: Add display attributes for transit plugin (#19575) 2023-04-10 14:20:53 -04:00
path_hash_test.go adding copyright header (#19555) 2023-03-15 09:00:52 -07:00
path_hmac.go openapi: Add display attributes for transit plugin (#19575) 2023-04-10 14:20:53 -04:00
path_hmac_test.go adding copyright header (#19555) 2023-03-15 09:00:52 -07:00
path_import.go Provide public key encryption via transit engine (#17934) 2023-05-11 11:56:46 +00:00
path_import_test.go Provide public key encryption via transit engine (#17934) 2023-05-11 11:56:46 +00:00
path_keys.go Provide public key encryption via transit engine (#17934) 2023-05-11 11:56:46 +00:00
path_keys_config.go openapi: Add display attributes for transit plugin (#19575) 2023-04-10 14:20:53 -04:00
path_keys_config_test.go adding copyright header (#19555) 2023-03-15 09:00:52 -07:00
path_keys_test.go adding copyright header (#19555) 2023-03-15 09:00:52 -07:00
path_random.go openapi: Add display attributes for transit plugin (#19575) 2023-04-10 14:20:53 -04:00
path_random_test.go adding copyright header (#19555) 2023-03-15 09:00:52 -07:00
path_restore.go openapi: Add display attributes for transit plugin (#19575) 2023-04-10 14:20:53 -04:00
path_restore_test.go adding copyright header (#19555) 2023-03-15 09:00:52 -07:00
path_rewrap.go openapi: Add display attributes for transit plugin (#19575) 2023-04-10 14:20:53 -04:00
path_rewrap_test.go adding copyright header (#19555) 2023-03-15 09:00:52 -07:00
path_rotate.go openapi: Add display attributes for transit plugin (#19575) 2023-04-10 14:20:53 -04:00
path_sign_verify.go openapi: Add display attributes for transit plugin (#19575) 2023-04-10 14:20:53 -04:00
path_sign_verify_test.go adding copyright header (#19555) 2023-03-15 09:00:52 -07:00
path_trim.go openapi: Add display attributes for transit plugin (#19575) 2023-04-10 14:20:53 -04:00
path_trim_test.go adding copyright header (#19555) 2023-03-15 09:00:52 -07:00
path_wrapping_key.go openapi: Add display attributes for transit plugin (#19575) 2023-04-10 14:20:53 -04:00
path_wrapping_key_test.go adding copyright header (#19555) 2023-03-15 09:00:52 -07:00
stepwise_test.go adding copyright header (#19555) 2023-03-15 09:00:52 -07:00