X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fbouncycastle%2Fcrypto%2Fengines%2FRSAEngine.java;fp=src%2Forg%2Fbouncycastle%2Fcrypto%2Fengines%2FRSAEngine.java;h=c02e20a45349d48fb646400f28c7bf38310a5315;hb=d70f271afd972a3bdeba9ee54b1e9a3334e6fe4b;hp=2cbac54ba1693f9f0c8a40a005bdc35c2226ca4b;hpb=3f13b8f2e9c92b428dc237327f3e86353902ac29;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..c02e20a 100644 --- a/src/org/bouncycastle/crypto/engines/RSAEngine.java +++ b/src/org/bouncycastle/crypto/engines/RSAEngine.java @@ -21,7 +21,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 +45,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 +58,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 +66,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; } }