Class InMemoryCertificateDirectoryBackend

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      pgp.certificate_store.certificate.Certificate doInsert​(java.io.InputStream data, pgp.certificate_store.certificate.KeyMaterialMerger merge)
      Insert a Certificate identified by its fingerprint into the directory.
      pgp.certificate_store.certificate.KeyMaterial doInsertTrustRoot​(java.io.InputStream data, pgp.certificate_store.certificate.KeyMaterialMerger merge)
      Insert a Key or Certificate as trust-root.
      pgp.certificate_store.certificate.Certificate doInsertWithSpecialName​(java.lang.String specialName, java.io.InputStream data, pgp.certificate_store.certificate.KeyMaterialMerger merge)
      Insert a Key or Certificate under the given special name.
      PGPCertificateDirectory.LockingMechanism getLock()
      Get the locking mechanism to write-lock the backend.
      java.lang.Long getTagForFingerprint​(java.lang.String fingerprint)
      Calculate the tag of the certificate with the given fingerprint.
      java.lang.Long getTagForSpecialName​(java.lang.String specialName)
      Calculate the tag of the certificate identified by the given special name.
      pgp.certificate_store.certificate.Certificate readByFingerprint​(java.lang.String fingerprint)
      Read a Certificate by its OpenPGP fingerprint.
      pgp.certificate_store.certificate.KeyMaterial readBySpecialName​(java.lang.String specialName)
      Read a Certificate or Key by the given special name.
      java.util.Iterator<pgp.certificate_store.certificate.Certificate> readItems()
      Return an Iterator of all Certificates in the store, except for certificates stored under a special name.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • InMemoryCertificateDirectoryBackend

        public InMemoryCertificateDirectoryBackend​(pgp.certificate_store.certificate.KeyMaterialReaderBackend reader)
    • Method Detail

      • readBySpecialName

        public pgp.certificate_store.certificate.KeyMaterial readBySpecialName​(java.lang.String specialName)
                                                                        throws pgp.certificate_store.exception.BadNameException
        Description copied from interface: PGPCertificateDirectory.Backend
        Read a Certificate or Key by the given special name.
        Specified by:
        readBySpecialName in interface PGPCertificateDirectory.Backend
        Parameters:
        specialName - special name
        Returns:
        certificate or key
        Throws:
        pgp.certificate_store.exception.BadNameException - if the special name is not known
      • readItems

        public java.util.Iterator<pgp.certificate_store.certificate.Certificate> readItems()
        Description copied from interface: PGPCertificateDirectory.Backend
        Return an Iterator of all Certificates in the store, except for certificates stored under a special name.
        Specified by:
        readItems in interface PGPCertificateDirectory.Backend
        Returns:
        iterator
      • doInsertTrustRoot

        public pgp.certificate_store.certificate.KeyMaterial doInsertTrustRoot​(java.io.InputStream data,
                                                                               pgp.certificate_store.certificate.KeyMaterialMerger merge)
                                                                        throws pgp.certificate_store.exception.BadDataException,
                                                                               java.io.IOException
        Description copied from interface: PGPCertificateDirectory.Backend
        Insert a Key or Certificate as trust-root.
        Specified by:
        doInsertTrustRoot in interface PGPCertificateDirectory.Backend
        Parameters:
        data - input stream containing the key material
        merge - callback to merge the key material with existing key material
        Returns:
        merged or inserted key material
        Throws:
        pgp.certificate_store.exception.BadDataException - if the data stream or existing key material contains bad data
        java.io.IOException - in case of an IO error
      • doInsert

        public pgp.certificate_store.certificate.Certificate doInsert​(java.io.InputStream data,
                                                                      pgp.certificate_store.certificate.KeyMaterialMerger merge)
                                                               throws java.io.IOException,
                                                                      pgp.certificate_store.exception.BadDataException
        Description copied from interface: PGPCertificateDirectory.Backend
        Insert a Certificate identified by its fingerprint into the directory.
        Specified by:
        doInsert in interface PGPCertificateDirectory.Backend
        Parameters:
        data - input stream containing the certificate data
        merge - callback to merge the certificate with existing key material
        Returns:
        merged or inserted certificate
        Throws:
        java.io.IOException - in case of an IO error
        pgp.certificate_store.exception.BadDataException - if the data stream or existing certificate contains bad data
      • doInsertWithSpecialName

        public pgp.certificate_store.certificate.Certificate doInsertWithSpecialName​(java.lang.String specialName,
                                                                                     java.io.InputStream data,
                                                                                     pgp.certificate_store.certificate.KeyMaterialMerger merge)
                                                                              throws java.io.IOException,
                                                                                     pgp.certificate_store.exception.BadDataException,
                                                                                     pgp.certificate_store.exception.BadNameException
        Description copied from interface: PGPCertificateDirectory.Backend
        Insert a Key or Certificate under the given special name.
        Specified by:
        doInsertWithSpecialName in interface PGPCertificateDirectory.Backend
        Parameters:
        specialName - special name to identify the key material with
        data - data stream containing the key or certificate
        merge - callback to merge the key/certificate with existing key material
        Returns:
        certificate component of the merged or inserted key material
        Throws:
        java.io.IOException - in case of an IO error
        pgp.certificate_store.exception.BadDataException - if the data stream or existing key material contains bad data
        pgp.certificate_store.exception.BadNameException - if the special name is not known
      • getTagForFingerprint

        public java.lang.Long getTagForFingerprint​(java.lang.String fingerprint)
                                            throws pgp.certificate_store.exception.BadNameException,
                                                   java.io.IOException
        Description copied from interface: PGPCertificateDirectory.Backend
        Calculate the tag of the certificate with the given fingerprint.
        Specified by:
        getTagForFingerprint in interface PGPCertificateDirectory.Backend
        Parameters:
        fingerprint - fingerprint
        Returns:
        tag
        Throws:
        pgp.certificate_store.exception.BadNameException - if the fingerprint is malformed
        java.io.IOException - in case of an IO error
      • getTagForSpecialName

        public java.lang.Long getTagForSpecialName​(java.lang.String specialName)
                                            throws pgp.certificate_store.exception.BadNameException,
                                                   java.io.IOException
        Description copied from interface: PGPCertificateDirectory.Backend
        Calculate the tag of the certificate identified by the given special name.
        Specified by:
        getTagForSpecialName in interface PGPCertificateDirectory.Backend
        Parameters:
        specialName - special name
        Returns:
        tag
        Throws:
        pgp.certificate_store.exception.BadNameException - if the special name is not known
        java.io.IOException - in case of an IO error