def unseal_signup_data(cls, sealed_signup_data): """ Args: sealed_signup_data: Sealed signup data that was returned previously in a EnclaveSignupInfo object from a call to create_signup_info Returns: A string The hex encoded PoET public key that was extracted from the sealed data """ # Reverse the process we used in creating "sealed" signup info. # Specifically, we will do a base 32 decode, which gives us json # we can convert back to a dictionary we can use to get the # data we need signup_data = \ json2dict(pybitcointools.base64.b32decode(sealed_signup_data)) with cls._lock: cls._poet_public_key = \ pybitcointools.decode_pubkey( signup_data.get('poet_public_key'), 'hex') cls._poet_private_key = \ pybitcointools.decode_privkey( signup_data.get('poet_public_key'), 'hex') cls._active_wait_timer = None return signup_data.get('poet_public_key')
def decode_pubkey(pubkey, encoding_format): return pybitcointools.decode_pubkey(pubkey, encoding_format)
import pybitcointools pub = pybitcointools.decode_pubkey( "03d299230be2bf10cad8f0b6f25c905c67e6a5896956c59adc8774c7e601946acf") print hex(pub[1]) pybitcointools.encode_pubkey(pub, "bin_compressed") pub1 = pybitcointools.decode_pubkey( "02a4e436bede8e4ed5f6193d64619b7dddbd42a3c26dcc057de79e8f0911342647") print hex(pub1[1]) pybitcointools.encode_pubkey(pub1, "bin_compressed") pub = pybitcointools.decode_pubkey( "0335644013e62b3576612253e1a9860e2b0c71c9033a711522606832bbcc733a44") print hex(pub[1]) pybitcointools.encode_pubkey(pub, "bin_compressed")
def multiply_pubkeys(p1, p2, n): f1, f2 = get_pubkey_format(p1), get_pubkey_format(p2) mp = fast_multiply(decode_pubkey(p2, f2), n) return encode_pubkey(fast_add(decode_pubkey(p1, f1), mp), f1)