return digest.digest();
}
catch (NoSuchAlgorithmException e)
{
throw new PGPException("can't find MD5", e);
}
catch (IOException e)
{
throw new PGPException("can't encode key components: " + e.getMessage(), e);
}
}
else
{
try
{
byte[] kBytes = publicPk.getEncodedContents();
MessageDigest digest = MessageDigest.getInstance("SHA1");
digest.update((byte)0x99);
digest.update((byte)(kBytes.length >> 8));
digest.update((byte)kBytes.length);
digest.update(kBytes);
return digest.digest();
}
catch (NoSuchAlgorithmException e)
{
throw new PGPException("can't find SHA1", e);
}
catch (IOException e)
{
throw new PGPException("can't encode key components: " + e.getMessage(), e);
}
}
}