(msg,hexPrivkey)
| 32 | return cryptor.decrypt(msg) |
| 33 | # Signs with hex private key |
| 34 | def sign(msg,hexPrivkey): |
| 35 | # pyelliptic is upgrading from SHA1 to SHA256 for signing. We must |
| 36 | # upgrade PyBitmessage gracefully. |
| 37 | # https://github.com/yann2192/pyelliptic/pull/33 |
| 38 | # More discussion: https://github.com/yann2192/pyelliptic/issues/32 |
| 39 | digestAlg = BMConfigParser().safeGet('bitmessagesettings', 'digestalg', 'sha1') |
| 40 | if digestAlg == "sha1": |
| 41 | # SHA1, this will eventually be deprecated |
| 42 | return makeCryptor(hexPrivkey).sign(msg, digest_alg=OpenSSL.digest_ecdsa_sha1) |
| 43 | elif digestAlg == "sha256": |
| 44 | # SHA256. Eventually this will become the default |
| 45 | return makeCryptor(hexPrivkey).sign(msg, digest_alg=OpenSSL.EVP_sha256) |
| 46 | else: |
| 47 | raise ValueError("Unknown digest algorithm %s" % (digestAlg)) |
| 48 | # Verifies with hex public key |
| 49 | def verify(msg,sig,hexPubkey): |
| 50 | # As mentioned above, we must upgrade gracefully to use SHA256. So |
nothing calls this directly
no test coverage detected