blueblank blueblank - 1 month ago 28
YAML Question

RSA public/private keys in YAML

I need to store an RSA key pair in a YAML file, but a still limited understanding of yaml syntax and a lack of examples has me searching for an answer.

I'll just start working with what I've got, but I was wondering if someone could explain quickly and concisely how I could store something of this nature in yaml.

Answer

You can store your keys as text ("ASCII-armored" / base 64 encoded). From Wikipedia, the syntax for multiline strings in YAML is:

- title: An example multi-line string in YAML
  body : |
    This is a multi-line string.
    "special" metacharacters may
    appear here. The extent of this string is
    indicated by indentation.