github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/website/content/docs/job-specification/hcl2/functions/crypto/rsadecrypt.mdx (about)

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