Skip to content

Instantly share code, notes, and snippets.

View vchervanev's full-sized avatar
🎯
Focusing

Vladimir Chervanev vchervanev

🎯
Focusing
View GitHub Profile

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@vchervanev
vchervanev / id_rsa_encryption.md
Created March 5, 2018 00:11
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

@vchervanev
vchervanev / yamls_to_csv.rb
Last active January 28, 2022 04:03
Export locale/*.yml files into a CSV [filename, key, value]
require 'yaml'
require 'csv'
def iterate_kv(hash, prefix=nil, &block)
hash.each do |k,v|
current_prefix = [prefix, k].compact.join('.')
if v.is_a?(Hash)
iterate_kv(v, current_prefix, &block)
else
yield current_prefix, v