File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
impl/src/test/groovy/io/jsonwebtoken/impl/security Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -63,14 +63,18 @@ class AbstractEcJwkFactoryTest {
63
63
def y = Decoders . BASE64URL . decode(ys)
64
64
def d = Decoders . BASE64URL . decode(ds)
65
65
66
- // most important part of the test: the decoded byte arrays must have a length equal to the curve
67
- // field size (in bytes):
66
+ // most important part of the test: 'x' and 'y' decoded byte arrays must have a length equal to the curve
67
+ // field size (in bytes) per https://datatracker.ietf.org/doc/html/rfc7518#section-6.2.1.2 and
68
+ // https://datatracker.ietf.org/doc/html/rfc7518#section-6.2.1.3
68
69
int fieldSizeInBits = key. getParams(). getCurve(). getField(). getFieldSize()
69
70
int fieldSizeInBytes = Bytes . length(fieldSizeInBits)
70
-
71
71
assertEquals fieldSizeInBytes, x. length
72
72
assertEquals fieldSizeInBytes, y. length
73
- assertEquals fieldSizeInBytes, d. length
73
+
74
+ // and 'd' must have a length equal to the curve order size in bytes per
75
+ // https://datatracker.ietf.org/doc/html/rfc7518#section-6.2.2.1
76
+ int orderSizeInBytes = Bytes . length(key. params. order. bitLength())
77
+ assertEquals orderSizeInBytes, d. length
74
78
}
75
79
}
76
80
}
You can’t perform that action at this time.
0 commit comments