@staticmethod
def from_der(der):
    ' Decodes a Signature that was DER-encoded.\n\n        Args:\n            der (bytes or str): The DER encoding to be decoded.\n\n        Returns:\n            Signature: The deserialized signature.\n        '
    d = get_bytes(der)
    if (len(d) < 8):
        raise ValueError('DER signature string is too short.')
    if (len(d) > 72):
        raise ValueError('DER signature string is too long.')
    if (d[0] != 48):
        raise ValueError('DER signature does not start with 0x30.')
    if (d[1] != len(d[2:])):
        raise ValueError('DER signature length incorrect.')
    total_length = d[1]
    if (d[2] != 2):
        raise ValueError('DER signature no 1st int marker.')
    if ((d[3] <= 0) or (d[3] > (total_length - 7))):
        raise ValueError('DER signature incorrect R length.')
    rlen = d[3]
    s_magic_index = (4 + rlen)
    rb = d[4:s_magic_index]
    if ((rb[0] & 128) != 0):
        raise ValueError('DER signature R is negative.')
    if ((len(rb) > 1) and (rb[0] == 0) and ((rb[1] & 128) != 128)):
        raise ValueError('DER signature R is excessively padded.')
    r = int.from_bytes(rb, 'big')
    if (d[s_magic_index] != 2):
        raise ValueError('DER signature no 2nd int marker.')
    slen_index = (s_magic_index + 1)
    slen = d[slen_index]
    if ((slen <= 0) or (slen > (len(d) - (slen_index + 1)))):
        raise ValueError('DER signature incorrect S length.')
    sb = d[(slen_index + 1):]
    if ((sb[0] & 128) != 0):
        raise ValueError('DER signature S is negative.')
    if ((len(sb) > 1) and (sb[0] == 0) and ((sb[1] & 128) != 128)):
        raise ValueError('DER signature S is excessively padded.')
    s = int.from_bytes(sb, 'big')
    if ((r < 1) or (r >= bitcoin_curve.n)):
        raise ValueError('DER signature R is not between 1 and N - 1.')
    if ((s < 1) or (s >= bitcoin_curve.n)):
        raise ValueError('DER signature S is not between 1 and N - 1.')
    return Signature(r, s)
Decodes a Signature that was DER-encoded.

Args:
    der (bytes or str): The DER encoding to be decoded.

Returns:
    Signature: The deserialized signature.
@staticmethod
def from_der(der):
    ' Decodes a Signature that was DER-encoded.\n\n        Args:\n            der (bytes or str): The DER encoding to be decoded.\n\n        Returns:\n            Signature: The deserialized signature.\n        '
    d = get_bytes(der)
    if (len(d) < 8):
        raise ValueError('DER signature string is too short.')
    if (len(d) > 72):
        raise ValueError('DER signature string is too long.')
    if (d[0] != 48):
        raise ValueError('DER signature does not start with 0x30.')
    if (d[1] != len(d[2:])):
        raise ValueError('DER signature length incorrect.')
    total_length = d[1]
    if (d[2] != 2):
        raise ValueError('DER signature no 1st int marker.')
    if ((d[3] <= 0) or (d[3] > (total_length - 7))):
        raise ValueError('DER signature incorrect R length.')
    rlen = d[3]
    s_magic_index = (4 + rlen)
    rb = d[4:s_magic_index]
    if ((rb[0] & 128) != 0):
        raise ValueError('DER signature R is negative.')
    if ((len(rb) > 1) and (rb[0] == 0) and ((rb[1] & 128) != 128)):
        raise ValueError('DER signature R is excessively padded.')
    r = int.from_bytes(rb, 'big')
    if (d[s_magic_index] != 2):
        raise ValueError('DER signature no 2nd int marker.')
    slen_index = (s_magic_index + 1)
    slen = d[slen_index]
    if ((slen <= 0) or (slen > (len(d) - (slen_index + 1)))):
        raise ValueError('DER signature incorrect S length.')
    sb = d[(slen_index + 1):]
    if ((sb[0] & 128) != 0):
        raise ValueError('DER signature S is negative.')
    if ((len(sb) > 1) and (sb[0] == 0) and ((sb[1] & 128) != 128)):
        raise ValueError('DER signature S is excessively padded.')
    s = int.from_bytes(sb, 'big')
    if ((r < 1) or (r >= bitcoin_curve.n)):
        raise ValueError('DER signature R is not between 1 and N - 1.')
    if ((s < 1) or (s >= bitcoin_curve.n)):
        raise ValueError('DER signature S is not between 1 and N - 1.')
    return Signature(r, s)