Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def der_encode_sig(r, s):
"""
Create DER encoded signature string with signature r and s value
:param r: r value of signature
:type r: int
:param s: s value of signature
:type s: int
:return bytes:
"""
if USE_FASTECDSA:
return DEREncoder.encode_signature(r, s)
else:
rb = ecdsa.der.encode_integer(r)
sb = ecdsa.der.encode_integer(s)
return ecdsa.der.encode_sequence(rb, sb)