forked from etotheipi/BitcoinArmory
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Approaching a usable, secure Bitcoin-Qt d/l in Windows
- Loading branch information
Showing
6 changed files
with
291 additions
and
13 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import sys | ||
sys.path.append('..') | ||
|
||
import getpass | ||
import os | ||
from armoryengine import * | ||
from verify_dl_list import * | ||
|
||
|
||
PRIV32 = getpass.getpass('Copy the private key here: ').replace(' ','') | ||
if not len(PRIV32)==64: | ||
print 'ERROR: Private key is not valid' | ||
exit(1) | ||
|
||
Priv = SecureBinaryData(hex_to_binary(PRIV32)) | ||
Pub = SecureBinaryData(hex_to_binary(ARMORY_INFO_SIGN_PUBLICKEY)) | ||
|
||
print 'Keys match? ', CryptoECDSA().CheckPubPrivKeyMatch(Priv, Pub) | ||
|
||
|
||
fn = 'versions.txt' | ||
if not os.path.exists(fn): | ||
print 'File does not exist!' | ||
|
||
f = open(fn, 'r') | ||
allVerStr = f.read() | ||
DICT,STR,SIG = parseDownloadList(allVerStr) | ||
Msg = SecureBinaryData(STR) | ||
|
||
result = CryptoECDSA().SignData(Msg, Priv) | ||
|
||
print 'Signature:', result.toHexStr() | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import sys | ||
sys.path.append('..') | ||
|
||
import os | ||
from armoryengine import * | ||
|
||
|
||
def parseDownloadList(wholeFile): | ||
""" | ||
This method returns a pair: a dictionary to lookup link by OS, and | ||
a formatted string that is sorted by OS, and re-formatted list that | ||
will hash the same regardless of original format or ordering | ||
""" | ||
DLDICT,DLLIST = {},[] | ||
for line in wholeFile.split('\n'): | ||
pcs = line.strip().strip('#').split() | ||
if len(pcs)==3 and pcs[1].startswith('http'): | ||
DLDICT[pcs[0]] = pcs[1:] | ||
DLLIST.append(pcs) | ||
if 'ARMORY-SIGNATURE' in line: | ||
sigHex = line.strip().split()[-1] | ||
|
||
DLLIST.sort(key=lambda x: x[0]) | ||
return DLDICT, ('\n'.join([' '.join(trip) for trip in DLLIST])), sigHex | ||
|
||
|
||
|
||
|
||
if __name__=='__main__': | ||
fn = 'versions.txt' | ||
if not os.path.exists(fn): | ||
print 'File does not exist!' | ||
|
||
f = open(fn, 'r') | ||
allVerStr = f.read() | ||
|
||
DICT,STR,SIG = parseDownloadList(allVerStr) | ||
|
||
for dl in DICT: | ||
print dl | ||
print ' ', DICT[dl][0] | ||
print ' ', DICT[dl][1] | ||
|
||
|
||
Pub = SecureBinaryData(hex_to_binary(ARMORY_INFO_SIGN_PUBLICKEY)) | ||
Msg = SecureBinaryData(STR) | ||
Sig = SecureBinaryData(hex_to_binary(SIG.split()[-1])) | ||
|
||
|
||
isVerified = CryptoECDSA().VerifyData(Msg, Sig, Pub) | ||
print '**********' | ||
print '' | ||
print 'Signature Matches Public Key:', isVerified | ||
print '' | ||
print '**********' | ||
|
||
|
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
Oops, something went wrong.