None of the following functions can be called with the arguments supplied. #977
-
Hello everyone, I could not use this fun signature! Any idea? .signWith(privateKey, Jwts.SIG.RS512) ` val kf = KeyFactory.getInstance("RSA")
other signatures work, but: None of the following functions can be called with the arguments supplied. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @ItSNeverLate ! ...
.signWith(privateKey, SignatureAlgorithm.RS512)
.compact() should be: ...
.signWith(privateKey, Jwts.SIG.RS512) // <-- Jwts.SIG.RS512
.compact() The I think that's the issue - let us know! |
Beta Was this translation helpful? Give feedback.
Hi @ItSNeverLate !
should be:
The
.signWith
method signature requires that key specified must be compatible with the pairedSignatureAlgorithm
instance. As such, the type of key required byJwts.SIG.RS512
must be aPrivateKey
, but it looks like you've typedval privateKey
to be just aKey
(and not aPrivateKey
as required).I think that's the issue - let us know!