Skip to content

Provided private key could not be used to sign JWT #99

Description

@Ginso

Hello,
i tried creating a JWT with the following code from your documentation:

let path = Bundle.main.path(forResource: "privateKey", ofType: "key")
let privateKeyPath = URL(fileURLWithPath: path!)
let privateKey: Data = try Data(contentsOf: privateKeyPath, options: .alwaysMapped)
let jwtSigner = JWTSigner.rs256(privateKey: privateKey)
let signedJwt = try jwt.sign(using: jwtSigner)

but at the last line i get an exception telling me that the 'Provided private key could not be used to sign JWT'.
I've first tried a key that has always worked in java and then a key generated with
ssh-keygen -t rsa -b 4096 -m PEM -f privateKey.key
The second one is much longer, but both keys produce the same result.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions