general class to handle a PGP public key object.
addCertification
public static PGPPublicKey addCertification(PGPPublicKey key,
String id,
PGPSignature certification)
Add a certification to the given public key.
key
- the key the certification is to be added to.id
- the id the certification is associated with.certification
- the new certification.
- the re-certified key.
addCertification
public static PGPPublicKey addCertification(PGPPublicKey key,
PGPSignature certification)
Add a revocation or some other key certification to a key.
key
- the key the revocation is to be added to.certification
- the key signature to be added.
- the new changed public key object.
encode
public void encode(OutputStream outStream)
throws IOException
getAlgorithm
public int getAlgorithm()
Return the algorithm code associated with the public key.
- int
getBitStrength
public int getBitStrength()
Return the strength of the key in bits.
- bit strenght of key.
getCreationTime
public Date getCreationTime()
- creation time of key.
getEncoded
public byte[] getEncoded()
throws IOException
getFingerprint
public byte[] getFingerprint()
Return the fingerprint of the key.
- key fingerprint.
getKey
public PublicKey getKey(String provider)
throws PGPException,
NoSuchProviderException
Return the public key contained in the object.
provider
- provider to construct the key for.
- PublicKey
PGPException
-
getKeyID
public long getKeyID()
Return the keyID associated with the public key.
- long
getSignatures
public Iterator getSignatures()
Return all signatures/certifications associated with this key.
- an iterator (possibly empty) with all signatures/certifications.
getSignaturesForID
public Iterator getSignaturesForID(String id)
Return any signatures associated with the passed in id.
id
- the id to be matched.
- an iterator of PGPSignature objects.
getSignaturesForUserAttribute
public Iterator getSignaturesForUserAttribute(PGPUserAttributeSubpacketVector userAttributes)
Return an iterator of signatures associated with the passed in user attributes.
userAttributes
- the vector of user attributes to be matched.
- an iterator of PGPSignature objects.
getSignaturesOfType
public Iterator getSignaturesOfType(int signatureType)
Return signatures of the passed in type that are on this key.
signatureType
- the type of the signature to be returned.
- an iterator (possibly empty) of signatures of the given type.
getUserAttributes
public Iterator getUserAttributes()
Return any user attribute vectors associated with the key.
- an iterator of PGPUserAttributeSubpacketVector objects.
getUserIDs
public Iterator getUserIDs()
Return any userIDs associated with the key.
- an iterator of Strings.
getValidDays
public int getValidDays()
- number of valid days from creation time - zero means no
expiry.
getVersion
public int getVersion()
- the version of this key.
isEncryptionKey
public boolean isEncryptionKey()
return true if this key is marked as suitable for encryption.
isMasterKey
public boolean isMasterKey()
Return true if this is a master key.
- true if a master key.
removeCertification
public static PGPPublicKey removeCertification(PGPPublicKey key,
String id)
Remove any certifications associated with a given id on a key.
key
- the key the certifications are to be removed from.id
- the id that is to be removed.
- the re-certified key, null if the id was not found on the key.
removeCertification
public static PGPPublicKey removeCertification(PGPPublicKey key,
String id,
PGPSignature certification)
Remove any certifications associated with a given id on a key.
key
- the key the certifications are to be removed from.id
- the id that the certfication is to be removed from.certification
- the certfication to be removed.
- the re-certified key, null if the certification was not found.