X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=src%2Forg%2Fbouncycastle%2Fcrypto%2Fengines%2FRSAEngine.java;h=0aaee2d4d1a051decafee35170e5e6e740f8cefd;hb=da1f843588c8bd2b2c7cc74a5b4ffff8d57ab712;hp=2cbac54ba1693f9f0c8a40a005bdc35c2226ca4b;hpb=e5e9355b4f4e0e2c8de9068a71c1e3cc26fa9905;p=org.ibex.core.git diff --git a/src/org/bouncycastle/crypto/engines/RSAEngine.java b/src/org/bouncycastle/crypto/engines/RSAEngine.java index 2cbac54..0aaee2d 100644 --- a/src/org/bouncycastle/crypto/engines/RSAEngine.java +++ b/src/org/bouncycastle/crypto/engines/RSAEngine.java @@ -5,7 +5,6 @@ import java.math.BigInteger; import org.bouncycastle.crypto.CipherParameters; import org.bouncycastle.crypto.DataLengthException; import org.bouncycastle.crypto.AsymmetricBlockCipher; -import org.bouncycastle.crypto.params.AsymmetricKeyParameter; import org.bouncycastle.crypto.params.RSAKeyParameters; import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters; @@ -21,7 +20,7 @@ public class RSAEngine /** * initialise the RSA engine. * - * @param forEncryption treu if we are encrypting, false otherwise. + * @param forEncryption true if we are encrypting, false otherwise. * @param param the necessary RSA key parameters. */ public void init( @@ -45,12 +44,7 @@ public class RSAEngine if (forEncryption) { - if ((bitSize % 8) == 0) - { - return bitSize / 8 - 1; - } - - return bitSize / 8; + return (bitSize + 7) / 8 - 1; } else { @@ -63,7 +57,7 @@ public class RSAEngine * For RSA this is always one byte less than the key size on * decryption, and the same length as the key size on encryption. * - * @return maximum size for an input block. + * @return maximum size for an output block. */ public int getOutputBlockSize() { @@ -71,11 +65,11 @@ public class RSAEngine if (forEncryption) { - return ((bitSize - 1) + 7) / 8; + return (bitSize + 7) / 8; } else { - return (bitSize - 7) / 8; + return (bitSize + 7) / 8 - 1; } }