github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/website/content/docs/job-specification/hcl2/functions/crypto/rsadecrypt.mdx (about)

     1  ---
     2  layout: docs
     3  page_title: rsadecrypt - Functions - Configuration Language
     4  description: The rsadecrypt function decrypts an RSA-encrypted message.
     5  ---
     6  
     7  # `rsadecrypt` Function
     8  
     9  `rsadecrypt` decrypts an RSA-encrypted ciphertext, returning the corresponding
    10  cleartext.
    11  
    12  ```hcl
    13  rsadecrypt(ciphertext, privatekey)
    14  ```
    15  
    16  `ciphertext` must be a base64-encoded representation of the ciphertext, using
    17  the PKCS #1 v1.5 padding scheme. Nomad uses the "standard" Base64 alphabet
    18  as defined in [RFC 4648 section 4](https://tools.ietf.org/html/rfc4648#section-4).
    19  
    20  `privatekey` must be a PEM-encoded RSA private key that is not itself
    21  encrypted.
    22  
    23  Nomad has no corresponding function for _encrypting_ a message. Use this
    24  function to decrypt ciphertexts returned by remote services using a keypair
    25  negotiated out-of-band.
    26  
    27  ## Examples
    28  
    29  ```shell-session
    30  > rsadecrypt(base64(file("${path.folder}/ciphertext")), file("privatekey.pem"))
    31  Hello, world!
    32  ```