Skip to content

Instantly share code, notes, and snippets.

@kiok46
kiok46 / id_rsa_encryption.md
Created May 15, 2017 14:07
Encrypt/Decrypt a File using your SSH Public/Private Key on Mac OS X

A Guide to Encrypting Files with Mac OS X

This guide will demonstrate the steps required to encrypt and decrypt files using OpenSSL on Mac OS X. The working assumption is that by demonstrating how to encrypt a file with your own public key, you'll also be able to encrypt a file you plan to send to somebody else using their private key, though you may wish to use this approach to keep archived data safe from prying eyes.

Too Long, Didn't Read

Assuming you've already done the setup described later in this document, that id_rsa.pub.pcks8 is the public key you want to use, that id_rsa is the private key the recipient will use, and secret.txt is the data you want to transmit…

Encrypting

$ openssl rand 192 -out key

$ openssl aes-256-cbc -in secret.txt -out secret.txt.enc -pass file:key

@kiok46
kiok46 / main.py
Created November 12, 2015 17:30 — forked from dustinfarris/main.py
Download a file in a Kivy application then open it in a separate application
#!/usr/bin/env python
import sys
sys.platform = 'linux2'
import os.path
import mimetypes
import urlparse
import requests