pub struct EncryptDataRequest {
pub mount: String,
pub name: String,
pub plaintext: String,
pub context: Option<String>,
pub key_version: Option<u64>,
pub nonce: Option<String>,
pub key_type: Option<KeyType>,
pub convergent_encryption: Option<String>,
}
Expand description
§Encrypt Data
This endpoint encrypts the provided plaintext using the named key. This path supports the create and update policy capabilities as follows: if the user has the create capability for this endpoint in their policies, and the key does not exist, it will be upserted with default values (whether the key requires derivation depends on whether the context parameter is empty or not). If the user only has update capability and the key does not exist, an error will be returned.
- Path: {self.mount}/encrypt/{self.name}
- Method: POST
- Response: EncryptDataResponse
- Reference: https://developer.hashicorp.com/vault/api-docs/secret/transit#encrypt-data
Fields§
§mount: String
§name: String
Specifies the name of the encryption key to encrypt against.
plaintext: String
Specifies base64 encoded plaintext to be encoded. NOTE: All plaintext data must be base64-encoded. The reason for this requirement is that Vault does not require that the plaintext is “text”. It could be a binary file such as a PDF or image. The easiest safe transport mechanism for this data as part of a JSON payload is to base64-encode it.
context: Option<String>
Specifies the base64 encoded context for key derivation. This is required if key derivation is enabled for this key.
key_version: Option<u64>
Specifies the version of the key to use for encryption. If not set, uses the latest version. Must be greater than or equal to the key’s min_encryption_version, if set.
nonce: Option<String>
Specifies the base64 encoded nonce value. This must be provided if convergent encryption is enabled for this key and the key was generated with Vault 0.6.1. Not required for keys created in 0.6.2+. The value must be exactly 96 bits (12 bytes) long and the user must ensure that for any given context (and thus, any given encryption key) this nonce value is never reused.
key_type: Option<KeyType>
This parameter is required when encryption key is expected to be created. When performing an upsert operation, the type of key to create.
convergent_encryption: Option<String>
This parameter will only be used when a key is expected to be created. Whether to support convergent encryption. This is only supported when using a key with key derivation enabled and will require all requests to carry both a context and 96-bit (12-byte) nonce. The given nonce will be used in place of a randomly generated nonce. As a result, when the same context and nonce are supplied, the same ciphertext is generated. It is very important when using this mode that you ensure that all nonces are unique for a given context. Failing to do so will severely impact the ciphertext’s security.
Implementations§
source§impl EncryptDataRequest
impl EncryptDataRequest
pub fn builder() -> EncryptDataRequestBuilder
Trait Implementations§
source§impl Debug for EncryptDataRequest
impl Debug for EncryptDataRequest
source§impl Default for EncryptDataRequest
impl Default for EncryptDataRequest
source§fn default() -> EncryptDataRequest
fn default() -> EncryptDataRequest
source§impl Endpoint for EncryptDataRequest
impl Endpoint for EncryptDataRequest
source§const REQUEST_BODY_TYPE: RequestType = RequestType::JSON
const REQUEST_BODY_TYPE: RequestType = RequestType::JSON
source§const RESPONSE_BODY_TYPE: ResponseType = ResponseType::JSON
const RESPONSE_BODY_TYPE: ResponseType = ResponseType::JSON
source§type Response = EncryptDataResponse
type Response = EncryptDataResponse
parse()
method is called.