Skip to content

Instantly share code, notes, and snippets.

@varshavaradarajan
Created March 2, 2019 20:20
Show Gist options
  • Save varshavaradarajan/ef13759505c3bb8d22c8d43fbfa0f0af to your computer and use it in GitHub Desktop.
Save varshavaradarajan/ef13759505c3bb8d22c8d43fbfa0f0af to your computer and use it in GitHub Desktop.
from Crypto.PublicKey import RSA
from Crypto.Signature import PKCS1_v1_5
from Crypto.Hash import SHA
from base64 import b64decode
import requests
key = 'need-to-populate'
rsa_key = RSA.importKey(key)
verifier = PKCS1_v1_5.new(rsa_key)
raw_cipher_data = b64decode(f.open('foo.txt.enc'))
foo = rsa_key.decrypt(raw_cipher_data)
// POST to API service
r = requests.post('', data = {'file':'foo.txt'})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment