{
log.log(20, "ssh-rsa signature: pos >= v.length");
return false;
}
SimpleDERReader dr = new SimpleDERReader(v, pos, v.length - pos);
byte[] seq = dr.readSequenceAsByteArray();
if (dr.available() != 0)
{
log.log(20, "ssh-rsa signature: dr.available() != 0");
return false;
}
dr.resetInput(seq);
/* Read digestAlgorithm */
byte digestAlgorithm[] = dr.readSequenceAsByteArray();
/* Inspired by RFC 3347, however, ignoring the comment regarding old BER based implementations */
if ((digestAlgorithm.length < 8) || (digestAlgorithm.length > 9))
{
log.log(20, "ssh-rsa signature: (digestAlgorithm.length < 8) || (digestAlgorithm.length > 9)");
return false;
}
byte[] digestAlgorithm_sha1 = new byte[] { 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00 };
for (int i = 0; i < digestAlgorithm.length; i++)
{
if (digestAlgorithm[i] != digestAlgorithm_sha1[i])
{
log.log(20, "ssh-rsa signature: digestAlgorithm[i] != digestAlgorithm_sha1[i]");
return false;
}
}
byte[] digest = dr.readOctetString();
if (dr.available() != 0)
{
log.log(20, "ssh-rsa signature: dr.available() != 0 (II)");
return false;
}