Skip to content

Commit

Permalink
Throw KeyException when loading an invalid PEM RSAKey (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvinmo authored Dec 12, 2023
2 parents 79b4917 + ca08987 commit 9ba121b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

All notable changes to this project will be documented in this file.

## Unreleased

- Fixed: Throw a `KeyException` when loading an invalid PEM-encoded
RSAKey

## 0.8.0

- Added: Support for `Ed25519` signatures and `X25519` key derviation
Expand Down
2 changes: 2 additions & 0 deletions src/SimpleJWT/Keys/RSAKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ public function __construct($data, $format, $password = null, $alg = 'PBES2-HS25
$jwk['dp'] = Util::base64url_encode($seq->getChildAt(6)->getValueAsUIntOctets());
$jwk['dq'] = Util::base64url_encode($seq->getChildAt(7)->getValueAsUIntOctets());
$jwk['qi'] = Util::base64url_encode($seq->getChildAt(8)->getValueAsUIntOctets());
} else {
throw new KeyException('Unrecognised key format');
}

parent::__construct($jwk);
Expand Down

0 comments on commit 9ba121b

Please sign in to comment.