Invalid PKCS1 padding
maf@appgate.com
maf@appgate.com
Fri, 4 Apr 2003 20:59:44 +0200 (CEST)
On 4 Apr, David Sewell wrote:
> I have upgraded to Mindterm 2.3.1 and receive the error 'Invalid PKCS1
> padding, type != 2', when using publickey authentication. The key file
> has been used successfully with various SSH implementations.
>
> I've noticed that this problem has been experienced by a number of
> users but I've not found any responses to the user queries in the
> archive. What causes this error and is there a fix?
This is caused by a bug in the mindterm code for
reading private keys from disk. The bug is in the file
com/mindbright/ssh/SSHRSAKeyFile.java. The following is an excerpt of
that file (with line-numbers added):
140 BigInteger d = dataIn.readBigInteger();
141 BigInteger u = dataIn.readBigInteger();
142 BigInteger p = dataIn.readBigInteger();
143 BigInteger q = dataIn.readBigInteger();
The problem is that the order the values are stored in the file is
actually d, u, q, p. So to fix it simply exchange line 142 and 143 so
you get:
140 BigInteger d = dataIn.readBigInteger();
141 BigInteger u = dataIn.readBigInteger();
142 BigInteger q = dataIn.readBigInteger();
143 BigInteger p = dataIn.readBigInteger();
This should fix the problem. An even better fix will be in the next release
of MindTerm (due out soon).
/MaF
--
Martin Forssen <maf@appgate.com> Development Manager
Phone: +46 31 7744361 AppGate Network Security AB