lib/acme/client/jwk/ecdsa.rb in acme-client-2.0.7 vs lib/acme/client/jwk/ecdsa.rb in acme-client-2.0.8
- old
+ new
@@ -71,11 +71,13 @@
ints = seq.value
# BigNumbers
bns = ints.map(&:value)
+ byte_size = (@private_key.group.degree + 7) / 8
+
# Binary R/S values
- r, s = bns.map { |bn| [bn.to_s(16)].pack('H*') }
+ r, s = bns.map { |bn| bn.to_s(2).rjust(byte_size, "\x00") }
# JWS wants raw R/S concatenated.
[r, s].join
end