www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - using joyent manta public cloud storage service

hello,
I'm trying to use the joyent manta storage service via their REST 
api.
https://apidocs.joyent.com/manta/api.html

For that i need to implement http signature over TLS.
Here is a shell function that does that;
function manta {

local alg=rsa-sha256
local keyId=/$MANTA_USER/keys/$MANTA_KEY_ID
local now=$(date -u "+%a, %d %h %Y %H:%M:%S GMT")
local sig=$(echo "date:" $now | \
             tr -d '\n' | \
             openssl dgst -sha256 -sign $HOME/.ssh/id_rsa | \
             openssl enc -e -a | tr -d '\n')

curl -sS $MANTA_URL"$ " -H "date: $now"  \
     -H "Authorization: Signature 
keyId=\"$keyId\",algorithm=\"$alg\",signature=\"$sig\""
}

How can I implement it in D using vibe.d? Specifically how do I 
sign and encode using my private key in D;
openssl dgst -sha256 -sign $HOME/.ssh/id_rsa | openssl enc -e -a 
| tr -d '\n')

Thanks.
Apr 13 2017