public class KeyGripCalculator
extends java.lang.Object
agent/keyformat.txt of the GnuPG
source tree.
The supplied PGPDigestCalculator must wrap SHA-1; the keygrip
algorithm is fixed by the GnuPG specification.
Currently RSA public keys are supported; the algorithm matches libgcrypt's
RSA compute_keygrip, which hashes n as it appears in the key's
S-expression: the signed (two's complement) big-endian encoding, so a modulus
with its top bit set, as every full-length RSA modulus has, is hashed with a
leading zero byte.
| Constructor and Description |
|---|
KeyGripCalculator(PGPDigestCalculator digestCalculator) |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
calculateKeygrip(BCPGKey key)
Compute the keygrip for the supplied PGP public-key material.
|
public KeyGripCalculator(PGPDigestCalculator digestCalculator)
digestCalculator - a SHA-1 digest calculator used to compute the keygrip.public byte[] calculateKeygrip(BCPGKey key) throws java.io.IOException
key - the BCPGKey to be hashed.java.io.IOException - if writing to the digest calculator fails.java.lang.IllegalArgumentException - if no keygrip algorithm is registered for the key type.