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
_gcry_rsa_compute_keygrip (SHA-1 of the canonical unsigned big-endian
encoding of the modulus n).
| 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.