Created
October 16, 2017 12:05
-
-
Save Habbie/23ef81ac9c4fed95720fe1970adddf23 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python | |
import sys | |
for line in sys.stdin: | |
parts = line.split() | |
if int(parts[6]) in (1, 5, 7, 8, 10): | |
pubkeys = ''.join(parts[7:]).replace(' ', '') | |
pubkey = pubkeys.decode('base64') | |
expoffset = 1 | |
explen = ord(pubkey[0]) | |
if not explen: | |
explen = ord(pubkey[1]) * 256 + ord(pubkey[2]) | |
expoffset = 4 | |
exponent = pubkey[expoffset:expoffset+explen] | |
modulus = pubkey[expoffset+explen:] | |
#print("exponent:", exponent.encode('base64')) | |
#print("modulus:", modulus.encode('base64')) | |
print modulus.encode('base64').replace('\n', ''), pubkeys | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment