public static ECDSASignature fromDerFormat(byte[] bytes) {
        try (ASN1InputStream decoder = new ASN1InputStream(bytes)) {
            DLSequence seq = (DLSequence) decoder.readObject();
            if (seq == null) {
                throw new RuntimeException("Reached past end of ASN.1 stream.");
            }
            ASN1Integer r, s;
            try {
                r = (ASN1Integer) seq.getObjectAt(0);
                s = (ASN1Integer) seq.getObjectAt(1);
            } catch (ClassCastException e) {
                throw new IllegalArgumentException(e);
            }
            // OpenSSL deviates from the DER spec by interpreting these values
            // as unsigned, though they should not be
            // Thus, we always use the positive versions. See:
            // http://r6.ca/blog/20111119T211504Z.html
            return new ECDSASignature(r.getPositiveValue(), s.getPositiveValue());
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
@Test
    void fromDerFormat() {
        ECDSASignature ecdsaSignature =
                CryptoUtils.fromDerFormat(Numeric.hexStringToByteArray(TX_SIGN_FORMAT_DER_HEX));

        assertEquals(ecdsaSignatureExample.r, ecdsaSignature.r);
        assertEquals(ecdsaSignatureExample.s, ecdsaSignature.s);
    }