Interface MongoKeyDecryptor


  • public interface MongoKeyDecryptor
    An interface representing a key decryption operation using a key management service.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      int bytesNeeded()
      Gets the number of bytes that should be received from the KMS server.
      void feed​(java.nio.ByteBuffer bytes)
      Feed the received bytes to the decryptor.
      java.lang.String getHostName()
      Gets the host name of the key management service.
      java.nio.ByteBuffer getMessage()
      Gets the message to send to the key management service.
    • Method Detail

      • getHostName

        java.lang.String getHostName()
        Gets the host name of the key management service.
        Returns:
        the host name
      • getMessage

        java.nio.ByteBuffer getMessage()
        Gets the message to send to the key management service.

        Clients should call this method first, and send the message on a TLS connection to a configured KMS server.

        Returns:
        the message to send
      • bytesNeeded

        int bytesNeeded()
        Gets the number of bytes that should be received from the KMS server.

        After sending the message to the KMS server, clients should call this method in a loop, receiving bytesNeeded from the KMS server and feeding those bytes to this decryptor, until bytesNeeded is 0.

        Returns:
        the actual number of bytes that clients should be prepared receive
      • feed

        void feed​(java.nio.ByteBuffer bytes)
        Feed the received bytes to the decryptor.

        After sending the message to the KMS server, clients should call this method in a loop, receiving the number of bytes indicated by a call to bytesNeeded() from the KMS server and feeding those bytes to this decryptor, until bytesNeeded() returns 0.

        Parameters:
        bytes - the received bytes