Mask openssh key

,

Problem to solve

I’m encountering an issue while attempting to add a private key as a CI variable. The problem arises from the inability to mask this key due to specific characters present within it. The error message received states:

This value cannot be masked because it contains the following characters: , and whitespace characters.

The private key I aim to mask is as follows:

----BEGIN OPENSSH PRIVATE KEY-----
<KEY>
-----END OPENSSH PRIVATE KEY-----

It appears that the spaces within the key may be causing the issue.

Steps to reproduce

Attempt to add a CI/CD variable using the provided private key pattern.

I overcome this problem with encoding the key, base 32 or base 16 should work :slight_smile:

it turns out you can add base64 variables and mask them! but you need to remove the linebreaks. Example:
openssl base64 -in <input_file> | tr -d ‘\n’