2016-09-27 14:48:21 +00:00
|
|
|
|
2017-04-08 16:43:26 +00:00
|
|
|
# extmod/modtrezorcrypto/modtrezorcrypto-ed25519.h
|
2016-10-24 13:44:49 +00:00
|
|
|
def generate_secret() -> bytes:
|
|
|
|
'''
|
|
|
|
Generate secret key.
|
|
|
|
'''
|
|
|
|
|
2017-04-08 16:43:26 +00:00
|
|
|
# extmod/modtrezorcrypto/modtrezorcrypto-ed25519.h
|
2016-09-27 14:48:21 +00:00
|
|
|
def publickey(secret_key: bytes) -> bytes:
|
|
|
|
'''
|
|
|
|
Computes public key from secret key.
|
|
|
|
'''
|
|
|
|
|
2017-04-08 16:43:26 +00:00
|
|
|
# extmod/modtrezorcrypto/modtrezorcrypto-ed25519.h
|
2016-09-27 14:48:21 +00:00
|
|
|
def sign(secret_key: bytes, message: bytes) -> bytes:
|
|
|
|
'''
|
|
|
|
Uses secret key to produce the signature of message.
|
|
|
|
'''
|
|
|
|
|
2017-04-08 16:43:26 +00:00
|
|
|
# extmod/modtrezorcrypto/modtrezorcrypto-ed25519.h
|
2016-09-27 14:48:21 +00:00
|
|
|
def verify(public_key: bytes, signature: bytes, message: bytes) -> bool:
|
|
|
|
'''
|
|
|
|
Uses public key to verify the signature of the message.
|
|
|
|
Returns True on success.
|
|
|
|
'''
|
2017-04-08 16:43:26 +00:00
|
|
|
|
|
|
|
# extmod/modtrezorcrypto/modtrezorcrypto-ed25519.h
|
|
|
|
def cosi_combine_publickeys(public_keys: list) -> bytes:
|
|
|
|
'''
|
|
|
|
Combines a list of public keys used in COSI cosigning scheme
|
|
|
|
'''
|
|
|
|
|
|
|
|
# extmod/modtrezorcrypto/modtrezorcrypto-ed25519.h
|
|
|
|
def cosi_combine_signatures(R: bytes, signatures: list) -> bytes:
|
|
|
|
'''
|
|
|
|
Combines a list of signatures used in COSI cosigning scheme
|
|
|
|
'''
|
|
|
|
|
|
|
|
# extmod/modtrezorcrypto/modtrezorcrypto-ed25519.h
|
|
|
|
def cosi_sign(secret_key: bytes, message: bytes, nonce: bytes, sigR: bytes, combined_pubkey: bytes) -> bytes:
|
|
|
|
'''
|
|
|
|
Produce signature of message using COSI cosigning scheme
|
|
|
|
'''
|