Added more descriptive backwards compatibility information

This commit is contained in:
Martin Treurnicht 2016-06-30 13:46:07 -07:00
parent 174e1b13b8
commit c3e5f95242
1 changed files with 7 additions and 1 deletions

View File

@ -41,7 +41,13 @@ public class EllipticCurveSignatureValidator extends EllipticCurveProvider imple
PublicKey publicKey = (PublicKey) key;
try {
int expectedSize = getSignatureByteArrayLength(alg);
//if the expected size is not valid for JOSE, fall back to ASN.1 DER signature
/**
*
* If the expected size is not valid for JOSE, fall back to ASN.1 DER signature.
* This fallback is for backwards compatibility ONLY (to support tokens generated by previous versions of jjwt)
* and backwards compatibility will possibly be removed in a future version of this library.
*
* **/
byte[] derSignature = expectedSize != signature.length && signature[0] == 0x30 ? signature : EllipticCurveProvider.transcodeSignatureToDER(signature);
return doVerify(sig, publicKey, data, derSignature);
} catch (Exception e) {