Created
April 8, 2015 21:27
-
-
Save taxilian/d42b8768b2e3ef5c6998 to your computer and use it in GitHub Desktop.
Python script to generate a chrome extension key and the matching id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hashlib | |
import os | |
from Crypto.PublicKey import RSA | |
KEYSIZE = 1024 | |
# Generate an RSA key | |
rsakey = RSA.generate(KEYSIZE, os.urandom) | |
# grab the public key portion | |
publickey = rsakey.publickey() | |
digest = hashlib.sha256(publickey.exportKey('DER')).hexdigest()[:32] | |
extension_id = ''.join(["abcdefghijklmnop"[int(i,16)] for i in digest]) | |
print ''.join(publickey.exportKey().split('\n')[1:-1]) | |
print extension_id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment