Skip to content

Instantly share code, notes, and snippets.

@therebelrobot
Created July 20, 2017 22:10
Show Gist options
  • Save therebelrobot/98311e527673214c5608fa9c825a2d4f to your computer and use it in GitHub Desktop.
Save therebelrobot/98311e527673214c5608fa9c825a2d4f to your computer and use it in GitHub Desktop.

Using jass To Send Encrypted Secrets

Install Jass

    git clone [email protected]:jschauma/jass $GOPATH/src/github.com/jschauma/jass
    cd $GOPATH/src/github.com/jschauma/jass
    make install

Encrypt and Decrypt Messages

Encrypt a secret for someone, using their Github public ssh key

    echo 'secret' | jass -G -u therebelrobot2

produces ciphertext that looks like

    begin-base64 600 message
    U2FsdGVkX1SQU7fn/BYMDbGt8CUSBGQSAa9sNUFVY=
    ====
    begin-base64 600 boggsboggs-5f:28:51:68:81:1c:73:8d:ef:fe:34:09:66:16:7d:81
    AsbVC6Mpr360NVG2x5mYtxujZA2ki4XAQUfvV41Htk9qRp191gRk6wjNve3KKjV+JziUB7CVOuB4
    Y1Qg7Oj6ydS32434ewefwet5wtwrgwwehhhw35rRubnewrwerwer223rqM9rpayqsUabR9VMVyKE
    UJd4Cv2ioZKKuAyVcUH6a3ljOeDZgdA8/V2f9/56eLBsqOPnf3HXYvqAikpqYLEM26LgEVNzgdwq
    xeG8u4DIzQVxKnmRDXazCs6f1QubSO0X6CLlJSvYZcfzj7+K15mN5+hXu06T1BGtmXz8wAWb5rMk
    uB66ny0N1qea4HMvHDGa4eT1nAdcak9Ae+ZNFA==
    ====
    begin-base64 600 version
    VkVSU0ljogNC4xCg==
    ====

The target user can decrypt the ciphertext on stdin with jass -d

    $ cat<<END | jass -d
    > begin-base64 600 message
    > U2FsdGVkXDSQU7fn/BYMDbGt8CUSBGQSAa9sNUFVY=
    > ====
    > begin-base64 600 boggsboggs-5f:28:51:68:81:1c:73:8d:ef:fe:34:09:66:16:7d:81
    > AsbVC6Mpr360NVG2x5mYtxujZA2ki4XAQUfvV41Htk9qRp191gRk6wjNve3KKjV+JziUB7CVOuB4
    > Y1Qg7Oj6ydSsdgg33ggdsdg22534ggrwrttHpwlqNByY+HEdzDVHAb5mMM9rpayqsUabR9VMVyKE
    > UJd4Cv2ioZKKuAyVcUH6a3ljOeDZgdA8/V2f9/56eLBsqOPnf3HXYvqAikpqYLEM26LgEVNzgdwq
    > xeG8u4DIzQVxKnmRDXazCs6f1QubSO0X6CLlJSvYZcfzj7+K15mN5+hXu06T1BGtmXz8wAWb5rMk
    > uB66ny0N1qea4HMvHDGa4eT1nAdcak9Ae+ZNFA==
    > ====
    > begin-base64 600 version
    > VkVSU0ljogNC4xCg==
    > ====
    > END
    Enter pass phrase for /Users/therebelrobot/.ssh/id_rsa: 
    secret

Any means of passing the ciphertext works. I like to copy to clipboard and then use pbpaste

$ echo 'secret' | jass -G -u therebelrobot2 | pbcopy
$ pbpaste | jass -d
Enter pass phrase for /Users/therebelrobot/.ssh/id_rsa: 
secret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment