We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a3c15cd commit 4422d39Copy full SHA for 4422d39
1 file changed
rust/auth-impls/src/jwt.rs
@@ -50,8 +50,11 @@ fn parse_public_key_pem(pem: &str) -> Result<PKey<Public>, ()> {
50
let body = pem
51
.trim()
52
.strip_prefix("-----BEGIN PUBLIC KEY-----")
53
- .ok_or(())?
54
- .strip_suffix("-----END PUBLIC KEY-----")
+ .and_then(|pem| pem.strip_suffix("-----END PUBLIC KEY-----"))
+ .or(pem
55
+ .trim()
56
+ .strip_prefix("-----BEGIN RSA PUBLIC KEY-----")
57
+ .and_then(|pem| pem.strip_suffix("-----END RSA PUBLIC KEY-----")))
58
.ok_or(())?;
59
let body: String = body.lines().map(|line| line.trim()).collect();
60
let body = STANDARD.decode(body).map_err(|_| ())?;
0 commit comments