wallet = wallet.create_wallet(config.get_wallet_type(), config.get_key_id(), logger) secure_message = SecureMessage(wallet) ## Test GET pubkey req_pubkey = requests.get(notary_url + '/api/v1/pubkey', verify=config.get_ssl_verify_mode()) data = req_pubkey.json() other_party_public_key = data['public_key'] print data['public_key'] address = str(wallet.get_bitcoin_address()) ## Test POST account print("\nWallet Public Key Hex %s" % wallet.get_public_key_hex()) print("\nWallet Public Key %s" % wallet.get_public_key()) addrfromhex = P2PKHBitcoinAddress.from_pubkey( wallet.get_public_key_hex().decode("hex")) print("\nAddress From Hex %s" % addrfromhex) email = test_data.email_address registration_message = { 'public_key': wallet.get_public_key_hex(), 'email': email } registration_payload = secure_message.create_secure_payload( other_party_public_key, json.dumps(registration_message)) response = requests.put(notary_url + '/api/v1/account/' + address, data=registration_payload,
import wallet import configuration import log_handlers config = configuration.NotaryConfiguration('./notaryconfig.ini') logger = log_handlers.get_logger(config) # wallet = wallet.create_wallet('PlainWallet', keyId, logger=None) wallet = wallet.create_wallet('ServerWallet', config, logger) # wallet = wallet.create_wallet('ClientWallet', keyId, logger=None) print("Wallet: Bitcoin Address %s " % wallet.get_bitcoin_address()) print("Wallet: Private Key WIF %s " % wallet.get_private_key_wif()) print("Wallet: Public Key Hex %s " % wallet.get_public_key_hex())
import encrypt import wallet from base58 import base58_check_encode import os from bitcoinlib.wallet import CBitcoinSecret, P2PKHBitcoinAddress import requests requests.packages.urllib3.disable_warnings() def privateKeyToWif(key_hex): return base58_check_encode(0x80, key_hex.decode('hex')) wallet = wallet.create_wallet(config.get_wallet_type(), config.get_key_id()) print("\nWallet Private Key %s" % wallet.get_private_key()) print("\nWallet Public Key %s" % wallet.get_public_key()) print("\nWallet Public Key Hex %s" % wallet.get_public_key_hex()) print("\nWallet Private Key WIF %s" % wallet.get_private_key_wif()) str = wallet.get_bitcoin_address() print("\nWallet Address %s" % wallet.get_bitcoin_address()) pubkeyhex = wallet.get_public_key_hex() pubkey = wallet.get_public_key() addrfrom = P2PKHBitcoinAddress.from_pubkey(pubkey) addrfromhex = P2PKHBitcoinAddress.from_pubkey(pubkeyhex.decode("hex")) print("\nAddress From %s" % addrfrom) print("\nAddress From Hex %s" % addrfromhex) message = "bitid://localhost:5000/callback?x=30f56bc022dde976&u=1" print("\nClear: %s" % message)
requests.packages.urllib3.disable_warnings() logger = log_handlers.get_logger(config) logger.debug("-------------------------ENVIRONMENT--------------------------") logger.debug("Am I Local: %s " % config.is_local_host()) wallet = wallet.create_wallet(config.get_wallet_type(), config.get_key_id(), logger) secure_message = SecureMessage(wallet) ## Test GET pubkey req_pubkey = requests.get(notary_url+'/api/v1/pubkey', verify=config.get_ssl_verify_mode()) data = req_pubkey.json() other_party_public_key = data['public_key'] print data['public_key'] address = str(wallet.get_bitcoin_address()) ## Test POST account print("\nWallet Public Key Hex %s" % wallet.get_public_key_hex()) print("\nWallet Public Key %s" % wallet.get_public_key()) addrfromhex = P2PKHBitcoinAddress.from_pubkey(wallet.get_public_key_hex().decode("hex")) print("\nAddress From Hex %s" % addrfromhex) email = test_data.email_address registration_message = {'public_key': wallet.get_public_key_hex(), 'email': email} registration_payload = secure_message.create_secure_payload(other_party_public_key, json.dumps(registration_message)) response = requests.put(notary_url+'/api/v1/account/' + address, data=registration_payload, verify=config.get_ssl_verify_mode()) print(response.status_code)
import file_stream_encrypt import wallet from bitcoinlib.core.key import CPubKey import requests requests.packages.urllib3.disable_warnings() file_name = "/Users/tssbi08/Downloads/jdk-8u65-macosx-x64.dmg" encrypted_file = "/Users/tssbi08/Downloads/encrypt_jdk-8u65-macosx-x64.dmg" decrypted_file = "/Users/tssbi08/Downloads/decrypt-8u65-macosx-x64.dmg" wallet = wallet.PlainWallet() public_key = CPubKey(wallet.get_public_key_hex().decode("hex")) file_stream_encrypt.encrypt_file(file_name,encrypted_file,public_key) file_stream_encrypt.decrypt_file(encrypted_file,decrypted_file,wallet.get_private_key_wif())