-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SignatureException is thrown at EVSE #19
Comments
Hi, Best regards, |
Hi Jan, So I need to dig deeper and will let you know once I found out. |
OK, I think I now found the solution to the problem and understood better how to handle DER encoded ECDSA signatures. DER-encoded integers are defined so that they can encode both positive and negative values (aka signed values). This means that the leftmost bit (first bit of the first byte in BigEndian) indicates whether the value is positive (0) or negative (1). For ECDSA, however, the r and s values are positive integers. So the leftmost bit must be a 0. If it's not, a 0x00 padding byte must be added. So the byte that encodes the length of r or s will either be 0x1F (31 bytes), 0x20 (32 bytes) or 0x21 (33 bytes), depending on the leftmost bit of the value of r or s. Case 31 bytes: Java seems to have cut off the leftmost 0x00 byte (doesn't change the value or r or s), and the leftmost bit of the remaining byte array is 0 (-> a positive value). Case 32 bytes: What we would normally expect, as the x- and y-coordinates are positive values of 32 bytes length. The leftmost bit is set to 0. Case 33 bytes: Java added another 0x00 fill byte as the most significant (leftmost) byte (doesn't change the value of r or s) because the original value had the leftmost bit set to 1, which would result in a negative value. I will go on and test the code once I corrected it and provide an updated release (probably today). |
Hi Marc, Thank you for digging into this. I already modified the BR, |
Hi Marc, My modifications to the aforementioned methods are working fine. Still i do not know if the "raw" signature is encoded according to ISO15118. As i cannot commit to this repository, i attached a patch file. Best Regards, 0001-Fix-for-the-issue-regarding-the-length-of-R-and-S-in.zip Jan |
Hi Jan, I just finished fixing the signature issue and will commit later that day. |
…eteringReceiptRes) and #19 (error in DER encoding of ECDSA signature)
Hi Jan, I looked at your code and I like your suggestion. There is only a slight modification needed in the getRAWSignatureFromDEREncoding() function. You'll see the changes to your code in the commit 0e4b838. I'm gonna close this ticket now. |
Hello,
When setting
DC_combo_core
as requested energy transfer mode, the Charging Loop Counter is not considered (see here). The charging loop is instead stopped by a SignatureException thrown in the SECC-Code.Apparently the signature of an
MeteringReciptReq
sent by the EVCC is invalid.This is propably the late result of an exception thrown by the EVCC-Code:
It seems the length of R and S are not always 32 or 33 but sometimes 31 as well.
How should this case be handled?
Logfiles for this run are attached. If you need more details i will provide them ASAP.
Thank You for the Support!
EVCC.log
Best regards,
Jan
The text was updated successfully, but these errors were encountered: