Package pgp.certificate_store
Interface PGPCertificateStore
-
public interface PGPCertificateStoreInterface for an OpenPGP certificate (public key) store.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CertificategetCertificate(java.lang.String identifier)Return the certificate that matches the given identifier.CertificategetCertificateIfChanged(java.lang.String identifier, java.lang.Long tag)Return the certificate that matches the given identifier, but only if it has been changed.java.util.Iterator<Certificate>getCertificates()Return anIteratorcontaining all certificates in the store.java.util.Iterator<Certificate>getCertificatesBySubkeyId(long subkeyId)Return anIteratorover all certificates in the store that contain a subkey with the given subkey id.java.util.Iterator<java.lang.String>getFingerprints()Return anIteratorcontaining all certificate fingerprints from the store.CertificateinsertCertificate(java.io.InputStream data, KeyMaterialMerger merge)Insert a certificate into the store.CertificateinsertCertificateBySpecialName(java.lang.String specialName, java.io.InputStream data, KeyMaterialMerger merge)Insert a certificate into the store.
-
-
-
Method Detail
-
getCertificate
Certificate getCertificate(java.lang.String identifier) throws java.io.IOException, BadNameException, BadDataException
Return the certificate that matches the given identifier. If no matching certificate can be found, return null.- Parameters:
identifier- identifier for a certificate.- Returns:
- certificate or null
- Throws:
java.io.IOException- in case of an IO-errorBadNameException- if the identifier is invalidBadDataException- if the certificate file contains invalid data
-
getCertificateIfChanged
Certificate getCertificateIfChanged(java.lang.String identifier, java.lang.Long tag) throws java.io.IOException, BadNameException, BadDataException
Return the certificate that matches the given identifier, but only if it has been changed. Whether it has been changed is determined by calculating the tag in the directory (e.g. by looking at the inode and last modification date) and comparing the result with the tag provided by the caller.- Parameters:
identifier- certificate identifiertag- tag by the caller- Returns:
- certificate if it has been changed, null otherwise
- Throws:
java.io.IOException- in case of an IO-errorBadNameException- if the identifier is invalidBadDataException- if the certificate file contains invalid data
-
getCertificatesBySubkeyId
java.util.Iterator<Certificate> getCertificatesBySubkeyId(long subkeyId) throws java.io.IOException, BadDataException
Return anIteratorover all certificates in the store that contain a subkey with the given subkey id.- Parameters:
subkeyId- id of the subkey- Returns:
- iterator
- Throws:
java.io.IOException- in case of an IO errorBadDataException- if any of the certificate files contains invalid data
-
insertCertificate
Certificate insertCertificate(java.io.InputStream data, KeyMaterialMerger merge) throws java.io.IOException, java.lang.InterruptedException, BadDataException
Insert a certificate into the store. If an instance of the certificate is already present in the store, the givenKeyMaterialMergerwill be used to merge both the existing and the new instance of theCertificate. The resulting merged certificate will be stored in the store and returned. This method will block until a write-lock on the store can be acquired.- Parameters:
data- input stream containing the new certificate instancemerge- callback for merging with an existing certificate instance- Returns:
- merged certificate
- Throws:
java.io.IOException- in case of an IO-errorjava.lang.InterruptedException- in case the inserting thread gets interruptedBadDataException- if the data stream does not contain valid OpenPGP data
-
insertCertificateBySpecialName
Certificate insertCertificateBySpecialName(java.lang.String specialName, java.io.InputStream data, KeyMaterialMerger merge) throws java.io.IOException, java.lang.InterruptedException, BadDataException, BadNameException
Insert a certificate into the store. The certificate will be stored under the given special name instead of its fingerprint. If an instance of the certificate is already present under the special name in the store, the givenKeyMaterialMergerwill be used to merge both the existing and the new instance of theCertificate. The resulting merged certificate will be stored in the store and returned. This method will block until a write-lock on the store can be acquired.- Parameters:
specialName- special name of the certificatedata- input stream containing the new certificate instancemerge- callback for merging with an existing certificate instance- Returns:
- merged certificate or null if the store cannot be locked
- Throws:
java.io.IOException- in case of an IO-errorjava.lang.InterruptedException- if the thread is interruptedBadDataException- if the certificate file does not contain valid OpenPGP dataBadNameException- if the special name is unknown
-
getCertificates
java.util.Iterator<Certificate> getCertificates()
Return anIteratorcontaining all certificates in the store. The iterator will contain both certificates addressed by special names and by fingerprints.- Returns:
- certificates
-
getFingerprints
java.util.Iterator<java.lang.String> getFingerprints()
Return anIteratorcontaining all certificate fingerprints from the store. Note that this only includes the fingerprints of certificate primary keys, not those of subkeys.- Returns:
- fingerprints
-
-