Correct ECDSA verify #197

Merged
Atheros1 merged 1 commits from master into master 2013-06-08 00:59:28 +02:00
4 changed files with 8 additions and 7 deletions

View File

@ -1,5 +1,5 @@
APP=pybitmessage APP=pybitmessage
VERSION=0.3.3 VERSION=0.3.3-2
DEST_SHARE=$(DESTDIR)/usr/share DEST_SHARE=$(DESTDIR)/usr/share
DEST_APP=$(DEST_SHARE)/$(APP) DEST_APP=$(DEST_SHARE)/$(APP)

View File

@ -8,7 +8,7 @@
APP=pybitmessage APP=pybitmessage
PREV_VERSION=0.3.2 PREV_VERSION=0.3.2
VERSION=0.3.3 VERSION=0.3.3-2
ARCH_TYPE=all ARCH_TYPE=all
#update version numbers automatically - so you don't have to #update version numbers automatically - so you don't have to

View File

@ -1343,10 +1343,12 @@ class receiveDataThread(threading.Thread):
readPosition += specifiedNonceTrialsPerByteLength readPosition += specifiedNonceTrialsPerByteLength
specifiedPayloadLengthExtraBytes, specifiedPayloadLengthExtraBytesLength = decodeVarint(data[readPosition:readPosition+10]) specifiedPayloadLengthExtraBytes, specifiedPayloadLengthExtraBytesLength = decodeVarint(data[readPosition:readPosition+10])
readPosition += specifiedPayloadLengthExtraBytesLength readPosition += specifiedPayloadLengthExtraBytesLength
endOfSignedDataPosition = readPosition
signatureLength, signatureLengthLength = decodeVarint(data[readPosition:readPosition+10]) signatureLength, signatureLengthLength = decodeVarint(data[readPosition:readPosition+10])
signature = data[readPosition:readPosition+signatureLengthLength] readPosition += signatureLengthLength
signature = data[readPosition:readPosition+signatureLength]
try: try:
if not highlevelcrypto.verify(data[8:readPosition],signature,publicSigningKey.encode('hex')): if not highlevelcrypto.verify(data[8:endOfSignedDataPosition],signature,publicSigningKey.encode('hex')):
print 'ECDSA verify failed (within processpubkey)' print 'ECDSA verify failed (within processpubkey)'
return return
print 'ECDSA verify passed (within processpubkey)' print 'ECDSA verify passed (within processpubkey)'
@ -2918,8 +2920,7 @@ class singleWorker(threading.Thread):
dataToEncrypt += '\x02' #message encoding type dataToEncrypt += '\x02' #message encoding type
dataToEncrypt += encodeVarint(len('Subject:' + subject + '\n' + 'Body:' + body)) #Type 2 is simple UTF-8 message encoding. dataToEncrypt += encodeVarint(len('Subject:' + subject + '\n' + 'Body:' + body)) #Type 2 is simple UTF-8 message encoding.
dataToEncrypt += 'Subject:' + subject + '\n' + 'Body:' + body dataToEncrypt += 'Subject:' + subject + '\n' + 'Body:' + body
signature = highlevelcrypto.sign(dataToEncrypt,privSigningKeyHex)
signature = highlevelcrypto.sign(payload,privSigningKeyHex)
dataToEncrypt += encodeVarint(len(signature)) dataToEncrypt += encodeVarint(len(signature))
dataToEncrypt += signature dataToEncrypt += signature
privEncryptionKey = hashlib.sha512(encodeVarint(addressVersionNumber)+encodeVarint(streamNumber)+ripe).digest()[:32] privEncryptionKey = hashlib.sha512(encodeVarint(addressVersionNumber)+encodeVarint(streamNumber)+ripe).digest()[:32]

View File

@ -1,4 +1,4 @@
softwareVersion = '0.3.3' softwareVersion = '0.3.3-2'
import threading import threading
import sys import sys