def unblind(csig, bldkey, grpkey=ffi.NULL, sig=ffi.NULL): """ Unblinds a blindly converted group signature, for schemes that support it. Optional parameters may be ignored in some schemes. Parameters: csig: A blindly converted group signature. bldkey: The blinding keypair. grpkey: Optional. The group key. sig: Optional. The unblinded group signature. Returns: An object containing: nym: A (possibly pseudonymized) identity of the signer. msg: A (possibly obfuscated) signed message. On error, an exception is thrown. """ msg = lib.message_init() nym = lib.identity_init(csig.scheme) if lib.groupsig_unblind(nym, sig, csig, grpkey, bldkey, msg) == lib.IERROR: raise Exception('Error unblinding signature.') return { 'nym': ffi.string(lib.identity_to_string(nym)), 'msg': ffi.string(lib.message_to_base64(msg)) } return
def proof_to_string(proof): _str = ffi.new("char *") _str = lib.groupsig_proof_to_string(proof) if _str == ffi.NULL: raise Exception('Error converting proof to string.') return ffi.string(_str).decode('utf8')
def identity_to_string(identity): """ Exports the given identity to a string. Parameters: identity: The identity to export. Returns: A string. On error, an Exception is thrown. """ string = lib.identity_to_string(identity) if string == ffi.NULL: raise Exception('Error converting id to string.') return ffi.string(string).decode('utf8')
def blindsig_to_string(sig): """ Returns a human readable string corresponding to the given blinded signature. Parameters: sig: The blinded signature to print. Returns: The produced string. On error, an Exception is thrown. """ _str = ffi.new("char *") _str = lib.groupsig_blindsig_to_string(sig) if _str == ffi.NULL: raise Exception('Error converting blindsig to string.') return ffi.string(_str).decode('utf8')
def message_to_base64(msg): """ Exports the given message object to a Base64 string. Parameters: msg: The message to export to a string. Returns: A Base64 string. On error, an Exception is thrown. """ _str = ffi.new("char *") _str = lib.message_to_base64(msg) if _str == ffi.NULL: raise Exception('Error converting message to a Base64 string.') return ffi.string(_str).decode('utf8')
def signature_to_string(sig): """ Returns a human readable string for the given group signature. Parameters: sig: The group signature. Returns: A human readable string. On error, an Exception is thrown. """ _str = ffi.new("char *") _str = lib.groupsig_signature_to_string(sig) if _str == ffi.NULL: raise Exception('Error converting signature to string.') return ffi.string(_str).decode('utf8')
def memkey_to_string(key): """ Returns a human readable string for the given member key. Parameters: key: The native member key data structure. Returns: A human readable string. On error, an Exception is thrown. """ _str = ffi.new("char *") _str = lib.groupsig_mem_key_to_string(key) if _str == ffi.NULL: raise Exception('Error converting member key to string.') return ffi.string(_str).decode('utf8')
def message_to_string(msg): """ Exports the given message object to a UTF-8 string. Use only for messages that are ensured to be strings. Parameters: msg: The message to export to a string. Returns: A UTF-8 string. On error, an Exception is thrown. """ _str = ffi.new("char *") _str = lib.message_to_string(msg) if _str == ffi.NULL: raise Exception('Error converting message to string.') return ffi.string(_str).decode('utf8')