Interface HpkeKdf


  • @Immutable
    public interface HpkeKdf
    Interface for Hybrid Public Key Encryption (HPKE) key derivation function (KDF).

    HPKE RFC is available at https://www.rfc-editor.org/rfc/rfc9180.html.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      byte[] extractAndExpand​(byte[] salt, byte[] ikm, java.lang.String ikmLabel, byte[] info, java.lang.String infoLabel, byte[] suiteId, int length)
      byte[] getKdfId()
      Returns the HPKE KDF algorithm identifier for the underlying KDF implementation.
      byte[] labeledExpand​(byte[] prk, byte[] info, java.lang.String infoLabel, byte[] suiteId, int length)
      Expands pseudorandom key prk into length pseudorandom bytes using info along with the HPKE-specific values infoLabel and suiteId to facilitate domain separation and context binding.
      byte[] labeledExtract​(byte[] salt, byte[] ikm, java.lang.String ikmLabel, byte[] suiteId)
      Extracts pseudorandom key from salt and ikm using the HPKE-specific values ikmLabel and suiteId to facilitate domain separation and context binding.
    • Method Detail

      • labeledExtract

        byte[] labeledExtract​(byte[] salt,
                              byte[] ikm,
                              java.lang.String ikmLabel,
                              byte[] suiteId)
                       throws java.security.GeneralSecurityException
        Extracts pseudorandom key from salt and ikm using the HPKE-specific values ikmLabel and suiteId to facilitate domain separation and context binding.

        More details available at https://www.rfc-editor.org/rfc/rfc9180.html#section-4-9.

        Parameters:
        salt - optional (possibly non-secret) random value
        ikm - input keying material
        ikmLabel - label prepended to ikm
        suiteId - HPKE cipher suite identifier prepended to { ikmLabel || ikm }
        Returns:
        pseudorandom key
        Throws:
        java.security.GeneralSecurityException
      • labeledExpand

        byte[] labeledExpand​(byte[] prk,
                             byte[] info,
                             java.lang.String infoLabel,
                             byte[] suiteId,
                             int length)
                      throws java.security.GeneralSecurityException
        Expands pseudorandom key prk into length pseudorandom bytes using info along with the HPKE-specific values infoLabel and suiteId to facilitate domain separation and context binding.

        More details available at https://www.rfc-editor.org/rfc/rfc9180.html#section-4-10.

        Parameters:
        prk - pseudorandom key
        info - optional context and application-specific information
        infoLabel - label prepended to info
        suiteId - HPKE cipher suite identifier prepended to { infoLabel || info }
        length - desired length (in bytes) of pseudorandom output
        Returns:
        length pseudorandom bytes of output keying material
        Throws:
        java.security.GeneralSecurityException
      • extractAndExpand

        byte[] extractAndExpand​(byte[] salt,
                                byte[] ikm,
                                java.lang.String ikmLabel,
                                byte[] info,
                                java.lang.String infoLabel,
                                byte[] suiteId,
                                int length)
                         throws java.security.GeneralSecurityException
        Combines labeledExtract(byte[], byte[], String, byte[]) and labeledExpand(byte[], byte[], String, byte[], int) into a single method.

        More details available at https://www.rfc-editor.org/rfc/rfc9180.html#section-4.1-3.

        Parameters:
        salt - optional (possibly non-secret) random value
        ikm - input keying material
        ikmLabel - label prepended to ikm
        info - optional context and application-specific information
        infoLabel - label prepended to info
        suiteId - HPKE cipher suite identifier prepended to { ikmLabel || ikm } and { infoLabel || info }
        length - desired length (in bytes) of pseudorandom output
        Returns:
        length pseudorandom bytes of output keying material
        Throws:
        java.security.GeneralSecurityException
      • getKdfId

        byte[] getKdfId()
                 throws java.security.GeneralSecurityException
        Returns the HPKE KDF algorithm identifier for the underlying KDF implementation.

        More details at https://www.rfc-editor.org/rfc/rfc9180.html#name-key-derivation-functions-kd.

        Throws:
        java.security.GeneralSecurityException