ShaneMcC / vyatta-tinc

[ARCHIVED] Vyatta package to allow configuring tinc vpn
GNU General Public License v2.0
17 stars 2 forks source link

Problems writing public and private keys #6

Closed sidneicarlos closed 7 years ago

sidneicarlos commented 8 years ago
formatKey() {
        TYPE="${1}"
        KEY="${2}"

        echo ""
        echo "-----BEGIN RSA ${TYPE} KEY-----"
        echo "${KEY}" | sed -r 's/(.{65})/\1\n/g'
        echo "-----END RSA ${TYPE} KEY-----"
}

Some tests and I found this:

$ a="MIIJKQIBAAKCAgEAycLwXe3lXQcm3xmuVdMg3G2CnUgskl1GkQZjJWdhdiAun4ZM/h1wqGgQkWTD7AGj60OE2ahYIBpMY+n7ofCBDXjV74AFIxEvQTX5deLD234x5o+0"
$ echo "$a" | sed -r 's/(.{65})/\1\n/g'
MIIJKQIBAAKCAgEAycLwXe3lXQcm3xmuVdMg3G2CnUgskl1GkQZjJWdhdiAun4ZM/
h1wqGgQkWTD7AGj60OE2ahYIBpMY+n7ofCBDXjV74AFIxEvQTX5deLD234x5o+0
$ echo "$a" | sed -r 's/(.{64})/\1\n/g'
MIIJKQIBAAKCAgEAycLwXe3lXQcm3xmuVdMg3G2CnUgskl1GkQZjJWdhdiAun4ZM
/h1wqGgQkWTD7AGj60OE2ahYIBpMY+n7ofCBDXjV74AFIxEvQTX5deLD234x5o+0

I think the line could be echo "${KEY}" | sed -r 's/(.{65})/\1\n/g'

sidneicarlos commented 8 years ago

And again... Thanks for the great work