Package io.quarkus.vault
Interface VaultTransitSecretReactiveEngine
- All Known Implementing Classes:
VaultTransitManager
public interface VaultTransitSecretReactiveEngine
A service that interacts with Hashicorp's Vault Transit secret engine to encrypt, decrypt and sign arbitrary data.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionio.smallrye.mutiny.Uni<Void>createKey(String keyName, KeyCreationRequestDetail detail) Create a new Transit key.io.smallrye.mutiny.Uni<ClearData>Decrypt the encrypted data with the specified key, and return unencrypted data.io.smallrye.mutiny.Uni<ClearData>decrypt(String keyName, String ciphertext, TransitContext transitContext) Decrypt the encrypted data with the specified key and a transit context used for key derivation.io.smallrye.mutiny.Uni<Map<DecryptionRequest,ClearData>> decrypt(String keyName, List<DecryptionRequest> requests) Decrypt a list of encrypted data items.io.smallrye.mutiny.Uni<Void>Delete a Transit key.io.smallrye.mutiny.Uni<String>encrypt(String keyName, ClearData clearData, TransitContext transitContext) Encrypt a regular string with a Vault key configured in the transit secret engine.io.smallrye.mutiny.Uni<String>Encrypt a regular string with a Vault key configured in the transit secret engine.io.smallrye.mutiny.Uni<Map<EncryptionRequest,String>> encrypt(String keyName, List<EncryptionRequest> requests) Encrypt a list of elements.io.smallrye.mutiny.Uni<VaultTransitKeyExportDetail>exportKey(String keyName, VaultTransitExportKeyType keyType, String keyVersion) Export a Transit Key.io.smallrye.mutiny.Uni<VaultTransitDataKey>generateDataKey(VaultTransitDataKeyType type, String keyName, VaultTransitDataKeyRequestDetail detail) Create a data keylistKeys()List all Transit keys.io.smallrye.mutiny.Uni<Optional<VaultTransitKeyDetail<?>>>Read the configuration of a Transit key.io.smallrye.mutiny.Uni<String>Reencrypt into a new cipher text a cipher text that was obtained from encryption using an old key version with the last key versionio.smallrye.mutiny.Uni<String>rewrap(String keyName, String ciphertext, TransitContext transitContext) Reencrypt into a new cipher text a cipher text that was obtained from encryption using an old key version with the last key version and an optional transit context used for key derivationio.smallrye.mutiny.Uni<Map<RewrappingRequest,String>> rewrap(String keyName, List<RewrappingRequest> requests) Reencrypt a list of encrypted data items with the last version of the specified key.io.smallrye.mutiny.Uni<Void>This endpoint rotates the version of the named key.io.smallrye.mutiny.Uni<String>sign(String keyName, SigningInput input, SignVerifyOptions options, TransitContext transitContext) Sign the input with the specified key and an optional explicit sign/verify options and an optional transit context used for key derivation, if applicable.io.smallrye.mutiny.Uni<String>sign(String keyName, SigningInput input, TransitContext transitContext) Sign the input with the specified key and an optional transit context used for key derivation, if applicable.io.smallrye.mutiny.Uni<String>Sign an input string with the specified key.io.smallrye.mutiny.Uni<Map<SigningRequest,String>> sign(String keyName, List<SigningRequest> requests) Sign a list of inputs items.io.smallrye.mutiny.Uni<Map<SigningRequest,String>> sign(String keyName, List<SigningRequest> requests, SignVerifyOptions options) Sign a list of inputs items and an optional explicit sign/verify options.io.smallrye.mutiny.Uni<Void>updateKeyConfiguration(String keyName, KeyConfigRequestDetail detail) Update the configuration of a Transit key.io.smallrye.mutiny.Uni<Void>verifySignature(String keyName, String signature, SigningInput input, SignVerifyOptions options, TransitContext transitContext) Checks that the signature was obtained from signing the input with the specified key an an optional explicit sign/verify options.io.smallrye.mutiny.Uni<Void>verifySignature(String keyName, String signature, SigningInput input, TransitContext transitContext) Checks that the signature was obtained from signing the input with the specified key.io.smallrye.mutiny.Uni<Void>verifySignature(String keyName, String signature, String input) Checks that the signature was obtained from signing the input with the specified key.io.smallrye.mutiny.Uni<Void>verifySignature(String keyName, List<VerificationRequest> requests) Checks a list of verification requests.io.smallrye.mutiny.Uni<Void>verifySignature(String keyName, List<VerificationRequest> requests, SignVerifyOptions options) Checks a list of verification requests.
-
Method Details
-
encrypt
Encrypt a regular string with a Vault key configured in the transit secret engine. Equivalent to:encrypt(keyName, ClearData.from(clearData), null);This method is usually used in conjunction with
decrypt(String, String)- Parameters:
keyName- the key to encrypt the data withclearData- the string to encrypt- Returns:
- cipher text
- See Also:
-
encrypt
io.smallrye.mutiny.Uni<String> encrypt(String keyName, ClearData clearData, TransitContext transitContext) Encrypt a regular string with a Vault key configured in the transit secret engine. If the key does not exist, and the policy specifies a create capability the key will be lazily created (i.e. upsert). The key can be further customized by specifying transit encryption-key configuration properties.- Parameters:
keyName- the key to encrypt the data withclearData- the data to encrypttransitContext- optional transit context used for key derivation- Returns:
- cipher text
- See Also:
-
encrypt
io.smallrye.mutiny.Uni<Map<EncryptionRequest,String>> encrypt(String keyName, List<EncryptionRequest> requests) Encrypt a list of elements. This will return a list of cipher texts. Each element shall specify the data to encrypt, an optional key version and an optional transit context, used for key derivation if applicable. If any error occurs, the service will throw aVaultEncryptionBatchException- Parameters:
keyName- the key to encrypt the data withrequests- the list of elements to encrypt- Returns:
- a map of each request and its corresponding cipher text
- See Also:
-
decrypt
Decrypt the encrypted data with the specified key, and return unencrypted data.- Parameters:
keyName- the key that was used to encrypt the original dataciphertext- the encrypted data- Returns:
- the unencrypted data
- See Also:
-
decrypt
io.smallrye.mutiny.Uni<ClearData> decrypt(String keyName, String ciphertext, TransitContext transitContext) Decrypt the encrypted data with the specified key and a transit context used for key derivation.- Parameters:
keyName- the key that was used to encrypt the original dataciphertext- data to decrypttransitContext- optional transit context used for key derivation- Returns:
- the unencrypted data
- See Also:
-
decrypt
io.smallrye.mutiny.Uni<Map<DecryptionRequest,ClearData>> decrypt(String keyName, List<DecryptionRequest> requests) Decrypt a list of encrypted data items. Each item shall specify the encrypted data plus an optional transit context used for key derivation (if applicable). If any error occurs, the service will throw aVaultDecryptionBatchException- Parameters:
keyName- the key that was used to encrypt the original datarequests- the list of encrypted data items- Returns:
- a map of each request with its corresponding decrypted data item
- See Also:
-
rewrap
Reencrypt into a new cipher text a cipher text that was obtained from encryption using an old key version with the last key version- Parameters:
keyName- the encryption key that was used for the previous encryptionciphertext- the old cipher text that needs rewrapping- Returns:
- the reencrypted cipher text with last key version as a new cipher text
- See Also:
-
rewrap
io.smallrye.mutiny.Uni<String> rewrap(String keyName, String ciphertext, TransitContext transitContext) Reencrypt into a new cipher text a cipher text that was obtained from encryption using an old key version with the last key version and an optional transit context used for key derivation- Parameters:
keyName- the encryption key that was used for the previous encryptionciphertext- the old cipher text that needs rewrappingtransitContext- optional transit context used for key derivation- Returns:
- the reencrypted cipher text with last key version as a new cipher text
- See Also:
-
rewrap
io.smallrye.mutiny.Uni<Map<RewrappingRequest,String>> rewrap(String keyName, List<RewrappingRequest> requests) Reencrypt a list of encrypted data items with the last version of the specified key. Each item shall specify a cipher text to reencrypt, an optional key version, and an optional transit context used for key derivation, if applicable. If any error occurs, the service will throw aVaultRewrappingBatchException- Parameters:
keyName- the encryption key that was used for the previous encryptionsrequests- the list of items to reencrypt- Returns:
- a map of each request with its corresponding reencrypted data item
- See Also:
-
sign
Sign an input string with the specified key.- Parameters:
keyName- the signing key to useinput- String to sign- Returns:
- the signature
- See Also:
-
sign
io.smallrye.mutiny.Uni<String> sign(String keyName, SigningInput input, TransitContext transitContext) Sign the input with the specified key and an optional transit context used for key derivation, if applicable.- Parameters:
keyName- the signing key to useinput- data to signtransitContext- optional transit context used for key derivation- Returns:
- the signature
- See Also:
-
sign
io.smallrye.mutiny.Uni<String> sign(String keyName, SigningInput input, SignVerifyOptions options, TransitContext transitContext) Sign the input with the specified key and an optional explicit sign/verify options and an optional transit context used for key derivation, if applicable.- Parameters:
keyName- the signing key to useinput- data to signoptions- optional explicit sign/verify optionstransitContext- optional transit context used for key derivation- Returns:
- the signature
- See Also:
-
sign
io.smallrye.mutiny.Uni<Map<SigningRequest,String>> sign(String keyName, List<SigningRequest> requests) Sign a list of inputs items. Each item shall specify the input to sign, an optional key version, and an optional transit context used for key derivation, if applicable. If any error occurs, the service will throw aVaultSigningBatchException- Parameters:
keyName- the signing key to userequests- the list of inputs to sign- Returns:
- a map of each request with its corresponding signature item
- See Also:
-
sign
io.smallrye.mutiny.Uni<Map<SigningRequest,String>> sign(String keyName, List<SigningRequest> requests, SignVerifyOptions options) Sign a list of inputs items and an optional explicit sign/verify options. Each item shall specify the input to sign, an optional key version, and an optional transit context used for key derivation, if applicable. If any error occurs, the service will throw aVaultSigningBatchException- Parameters:
keyName- the signing key to userequests- the list of inputs to signoptions- optional explicit sign/verify options- Returns:
- a map of each request with its corresponding signature item
- See Also:
-
verifySignature
Checks that the signature was obtained from signing the input with the specified key. The service will throw aVaultExceptionif this is not the case.- Parameters:
keyName- the key that was used to sign the inputsignature- the signature obtained from one of the sign methodsinput- the original input data- See Also:
-
verifySignature
io.smallrye.mutiny.Uni<Void> verifySignature(String keyName, String signature, SigningInput input, TransitContext transitContext) Checks that the signature was obtained from signing the input with the specified key. The service will throw aVaultExceptionif this is not the case.- Parameters:
keyName- the key that was used to sign the inputsignature- the signature obtained from one of the sign methodsinput- the original input datatransitContext- optional transit context used for key derivation- See Also:
-
verifySignature
io.smallrye.mutiny.Uni<Void> verifySignature(String keyName, String signature, SigningInput input, SignVerifyOptions options, TransitContext transitContext) Checks that the signature was obtained from signing the input with the specified key an an optional explicit sign/verify options. The service will throw aVaultExceptionif this is not the case.- Parameters:
keyName- the key that was used to sign the inputsignature- the signature obtained from one of the sign methodsinput- the original input dataoptions- optional explicit sign/verify optionstransitContext- optional transit context used for key derivation- See Also:
-
verifySignature
Checks a list of verification requests. Each request shall specify an input and the signature we want to match against, and an optional transit context used for key derivation, if applicable. If the signature does not match, or if any other error occurs, the service will throw aVaultVerificationBatchException- Parameters:
keyName- the key that was used to sign the inputrequests- a list of items specifying an input and a signature to match against- See Also:
-
verifySignature
io.smallrye.mutiny.Uni<Void> verifySignature(String keyName, List<VerificationRequest> requests, SignVerifyOptions options) Checks a list of verification requests. Each request shall specify an input and the signature we want to match against, and an optional explicit sign/verify options and an optionals transit context used for key derivation, if applicable. If the signature does not match, or if any other error occurs, the service will throw aVaultVerificationBatchException- Parameters:
keyName- the key that was used to sign the inputrequests- a list of items specifying an input and a signature to match againstoptions- optional explicit sign/verify options- See Also:
-
createKey
Create a new Transit key.- Parameters:
keyName- key namedetail- key creation detail or null- See Also:
-
updateKeyConfiguration
Update the configuration of a Transit key. The key must exist.- Parameters:
keyName- key namedetail- key configuration detail- See Also:
-
rotateKey
This endpoint rotates the version of the named key. After rotation, new plaintext requests will be encrypted with the new version of the key.- Parameters:
keyName- the key name- See Also:
-
deleteKey
Delete a Transit key. Key must have been configured with deletion allowed. The key must exist.- Parameters:
keyName- key name- See Also:
-
exportKey
io.smallrye.mutiny.Uni<VaultTransitKeyExportDetail> exportKey(String keyName, VaultTransitExportKeyType keyType, String keyVersion) Export a Transit Key. Key must have made exportable through creation or configuration update. The key must exist.- Parameters:
keyName- name of the keykeyType- key typekeyVersion- null, "latest" or a valid version number as a String. If null all versions will be returned- Returns:
- All specified key versions
- See Also:
-
readKey
Read the configuration of a Transit key.- Parameters:
keyName- key name- Returns:
- key detail, or null if the key does not exist
- See Also:
-
listKeys
List all Transit keys.- Returns:
- key names
- See Also:
-
generateDataKey
io.smallrye.mutiny.Uni<VaultTransitDataKey> generateDataKey(VaultTransitDataKeyType type, String keyName, VaultTransitDataKeyRequestDetail detail) Create a data key- Parameters:
type- plaintext or wrappedkeyName- the key namedetail- optional context, nonce and bits- Returns:
- the generated data key
- See Also:
-