JwsExtensions

Functions

Link copied to clipboard

JWS spec concatenates the R and S values, but JCA needs an ASN.1 structure (SEQUENCE of two INTEGER) around it

Link copied to clipboard

Encode as a four-byte array

Link copied to clipboard

Encode the length of (as four bytes) plus the value itself

Link copied to clipboard

Drops or adds zero bytes at the start until the size is reached

Link copied to clipboard

Extracts the plain R and S values of an ECDSA signature if it is wrapped in an ASN.1 Sequence of two ASN.1 Integers (e.g. when computed in Java)

Link copied to clipboard

The extracted values from ASN.1 may be too short to be simply concatenated as raw values, so we'll need to pad them with 0x00 bytes to the expected length

Link copied to clipboard

Strips the leading 0x00 byte of an ASN.1-encoded Integer, that will be there if the first bit of the value is set, i.e. it is over 0x7F (or < 0 if it is signed)