How to extract raw 64 byte EC signature from an ASN1/DER encoded signature (which ranges from 70 - 72 bytes)
You are on the right track. R and S data bytes typically encode 256-bit values (32 bytes). However, integers in DER are signed, which means that if their highest bit is set, they are interpreted as negative. For that reason, if the R or S value being encoded has their first byte >= 0x80, it would mean a negative number, and hence a null byte is appended taking the length to 33 bytes. So to encode the signature to 64 bytes, just take the last 32 bytes each of the R and S values.