Package org.pgpainless.key
Class SubkeyIdentifier
java.lang.Object
org.pgpainless.key.SubkeyIdentifier
Tuple class used to identify a subkey by fingerprints of the primary key of the subkeys key ring,
as well as the subkeys fingerprint.
-
Constructor Summary
ConstructorsConstructorDescriptionSubkeyIdentifier(org.bouncycastle.openpgp.PGPKeyRing keyRing) Create aSubkeyIdentifierfrom aPGPKeyRing.SubkeyIdentifier(org.bouncycastle.openpgp.PGPKeyRing keyRing, long keyId) Create aSubkeyIdentifierfrom aPGPKeyRingand the subkeys key id.SubkeyIdentifier(org.bouncycastle.openpgp.PGPKeyRing keyRing, OpenPgpFingerprint subkeyFingerprint) SubkeyIdentifier(OpenPgpFingerprint primaryKeyFingerprint) Create aSubkeyIdentifierthat identifies the primary key with the given fingerprint.SubkeyIdentifier(OpenPgpFingerprint primaryKeyFingerprint, OpenPgpFingerprint subkeyFingerprint) Create aSubkeyIdentifierwhich points to the subkey with the given subkeyFingerprint, which has a primary key with the given primaryKeyFingerprint. -
Method Summary
Modifier and TypeMethodDescriptionbooleanlonggetKeyId()Return theOpenPgpFingerprintof the primary key of the identified key.longReturn the key id of the primary key of the identified key.Return theOpenPgpFingerprintof the identified subkey.longReturn the key id of the identified subkey.inthashCode()toString()
-
Constructor Details
-
SubkeyIdentifier
public SubkeyIdentifier(org.bouncycastle.openpgp.PGPKeyRing keyRing) Create aSubkeyIdentifierfrom aPGPKeyRing. The identifier will point to the primary key of the provided ring.- Parameters:
keyRing- key ring
-
SubkeyIdentifier
public SubkeyIdentifier(@Nonnull org.bouncycastle.openpgp.PGPKeyRing keyRing, long keyId) Create aSubkeyIdentifierfrom aPGPKeyRingand the subkeys key id.getPrimaryKeyFingerprint()will return theOpenPgpFingerprintof the keyrings primary key, whilegetSubkeyFingerprint()will return the subkeys fingerprint.- Parameters:
keyRing- keyring the subkey belongs tokeyId- keyid of the subkey
-
SubkeyIdentifier
public SubkeyIdentifier(@Nonnull org.bouncycastle.openpgp.PGPKeyRing keyRing, @Nonnull OpenPgpFingerprint subkeyFingerprint) -
SubkeyIdentifier
Create aSubkeyIdentifierthat identifies the primary key with the given fingerprint. This means, bothgetPrimaryKeyFingerprint()andgetSubkeyFingerprint()return the same.- Parameters:
primaryKeyFingerprint- fingerprint of the identified key
-
SubkeyIdentifier
public SubkeyIdentifier(@Nonnull OpenPgpFingerprint primaryKeyFingerprint, @Nonnull OpenPgpFingerprint subkeyFingerprint) Create aSubkeyIdentifierwhich points to the subkey with the given subkeyFingerprint, which has a primary key with the given primaryKeyFingerprint.- Parameters:
primaryKeyFingerprint- fingerprint of the primary keysubkeyFingerprint- fingerprint of the subkey
-
-
Method Details
-
getFingerprint
-
getKeyId
public long getKeyId() -
getPrimaryKeyFingerprint
Return theOpenPgpFingerprintof the primary key of the identified key. This might be the same asgetSubkeyFingerprint()if the identified subkey is the primary key.- Returns:
- primary key fingerprint
-
getPrimaryKeyId
public long getPrimaryKeyId()Return the key id of the primary key of the identified key. This might be the same asgetSubkeyId()if the identified subkey is the primary key.- Returns:
- primary key id
-
getSubkeyFingerprint
Return theOpenPgpFingerprintof the identified subkey.- Returns:
- subkey fingerprint
-
getSubkeyId
public long getSubkeyId()Return the key id of the identified subkey.- Returns:
- subkey id
-
hashCode
public int hashCode() -
equals
-
toString
-