Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/quite/humla-spongycastle.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/bouncycastle/crypto/kems/RSAKeyEncapsulation.java')
-rwxr-xr-xsrc/main/java/org/bouncycastle/crypto/kems/RSAKeyEncapsulation.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/org/bouncycastle/crypto/kems/RSAKeyEncapsulation.java b/src/main/java/org/bouncycastle/crypto/kems/RSAKeyEncapsulation.java
index 5ffd356a..ae76881e 100755
--- a/src/main/java/org/bouncycastle/crypto/kems/RSAKeyEncapsulation.java
+++ b/src/main/java/org/bouncycastle/crypto/kems/RSAKeyEncapsulation.java
@@ -17,6 +17,9 @@ import org.bouncycastle.util.BigIntegers;
public class RSAKeyEncapsulation
implements KeyEncapsulation
{
+ private static final BigInteger ZERO = BigInteger.valueOf(0);
+ private static final BigInteger ONE = BigInteger.valueOf(1);
+
private DerivationFunction kdf;
private SecureRandom rnd;
private RSAKeyParameters key;
@@ -75,7 +78,7 @@ public class RSAKeyEncapsulation
BigInteger e = key.getExponent();
// Generate the ephemeral random and encode it
- BigInteger r = BigIntegers.createRandomInRange(BigInteger.ZERO, n.subtract(BigInteger.ONE), rnd);
+ BigInteger r = BigIntegers.createRandomInRange(ZERO, n.subtract(ONE), rnd);
byte[] R = BigIntegers.asUnsignedByteArray((n.bitLength()+7)/8, r);
// Encrypt the random and encode it