Skip to content

Commit 5fc61e7

Browse files
committed
added check for case where both halfs of the signature are short by 1.
1 parent 3c9c1fa commit 5fc61e7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkix/src/main/java/org/bouncycastle/eac/operator/jcajce/JcaEACSignerBuilder.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@ private static byte[] reencode(byte[] rawSign)
142142

143143
byte[] ret;
144144
int len = max(rLen, sLen);
145+
// TODO: ideally this would be based on the field length
146+
// if both sides are short, len might be short
147+
if ((len & 0x01) != 0)
148+
{
149+
len++;
150+
}
145151

146152
ret = new byte[len * 2];
147153
Arrays.fill(ret, (byte)0);

0 commit comments

Comments
 (0)