Comments (5)
Just wanted to drop in and say that this issue occurred for me due to the lack of newlines, as I was trying to pass it in through an environment variable. When I added them back in, this issue went away.
from jwt.
I used .replacingOccurrences(of: "\\n", with: "\n") after private key reading from .env
from jwt.
This appears to be due to passing an X.509 certificate (a PEM blob starting with ------BEGIN CERTIFICATE------
) to the public key initializer for RS256, which invokes PEM_read_bio_PUBKEY()
- the PUBKEY
variant expects a PKCS#8 public key (PEM blob starting with ------BEGIN PUBLIC KEY------
, wrapping a SubjectPublicKeyInfo
tagged as rsaEncryption
and in turn containing an RSAPublicKey
). While an X.509v3 certificate does indeed contain a public key, it unfortunately can not be directly parsed as if it were one.
JWTKit
should provide a .public(x509:)
convenience utility, since extracting a certificate's public key in PKCS#8 PEM form is either a ridiculous ring-around-the-rosy using NIOSSL, or else just painful using BoringSSL directly. However, this is not a bug as such.
from jwt.
Just message for future developers: jWTKit now providing x509 initialization thru .certificate(pem: cert)
from jwt.
Heads up to devs sending push notifications through their servers and omitting the Apple ECP8 Private Key from their code because they made the project public and don't want the key revealed: JWT will scream at you if it doesn't see a proper key passed
func configurePush() throws {
let appleECP8PrivateKey =
"""
-----BEGIN PRIVATE KEY-----
<--- HERE!
-----END PRIVATE KEY-----
"""
apns.configuration = try .init(
authenticationMethod: .jwt(
key: .private(pem: Data(appleECP8PrivateKey.utf8)),
keyIdentifier: "",
teamIdentifier: ""
),
topic: "com.rafaelschmitt.MyApp",
environment: .production
)
}
Just comment this code out while you test.
from jwt.
Related Issues (20)
- ES256 implementation is incorrect HOT 1
- Sporadic failure of ES256 HOT 2
- Allow JWT to be extended by user HOT 3
- Documentation request. HOT 2
- Allow configuration of URIs in JWT helpers HOT 6
- Multiple JWT signers not working as expected HOT 1
- `bioConversionFailure` in `ECDSAKey` when using `P384` HOT 7
- This framework doesn't consider someone may use it in macOS? HOT 8
- Support for Swift 2.1 HOT 1
- Carthage support HOT 2
- Is this library can be installed using pods? HOT 4
- Missing RSA Encryption Algorithms HOT 3
- JWK Verification HOT 2
- integrate JWTKit with Vapor HOT 9
- Broken link to documentation HOT 1
- Library not working with Swift 3 HOT 1
- Missing ECDSASigner to support ES256 … HOT 4
- '&' used with non-inout argument of type 'JWT<_>' HOT 1
- [Question] - Encode with RS256 using string data of a private key HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jwt.