Skip to content

Commit 60c7742

Browse files
committed
LibCrypto: Check ECPrivateKey version
1 parent 3810e3b commit 60c7742

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Libraries/LibCrypto/PK/EC.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ ErrorOr<EC::KeyPairType> EC::parse_ec_key(ReadonlyBytes der, bool is_private, Ve
8787
READ_OBJECT(Integer, Crypto::UnsignedBigInteger, version);
8888
POP_SCOPE();
8989

90+
if (version != 1) {
91+
ERROR_WITH_SCOPE("Invalid version");
92+
}
93+
9094
PUSH_SCOPE("privateKey");
9195
READ_OBJECT(OctetString, StringView, private_key_bytes);
9296
POP_SCOPE();

0 commit comments

Comments
 (0)