mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8216012: Infinite loop in RSA KeyPairGenerator
Check and error out on even RSA public exponents Reviewed-by: valeriep
This commit is contained in:
parent
0b2da9e239
commit
567465c62c
2 changed files with 99 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -96,6 +96,10 @@ public abstract class RSAKeyPairGenerator extends KeyPairGeneratorSpi {
|
|||
throw new InvalidAlgorithmParameterException
|
||||
("Public exponent must be 3 or larger");
|
||||
}
|
||||
if (!tmpPublicExponent.testBit(0)) {
|
||||
throw new InvalidAlgorithmParameterException
|
||||
("Public exponent must be an odd number");
|
||||
}
|
||||
if (tmpPublicExponent.bitLength() > tmpKeySize) {
|
||||
throw new InvalidAlgorithmParameterException
|
||||
("Public exponent must be smaller than key size");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue