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.
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.