[OTR-dev] Symmetric key retrieval

Ian Goldberg ian at cypherpunks.ca
Wed Jul 2 14:41:01 EDT 2008


For Paul :-)

I've checked in support for applications asking libotr for a
forward-secret symmetric key.

Call this function if you want one:

/* Get the current extra symmetric key (of size OTRL_EXTRAKEY_BYTES
 * bytes) and let the other side know what we're going to use it for.
 * The key is stored in symkey, which must already be allocated
 * and OTRL_EXTRAKEY_BYTES bytes long. */
gcry_error_t otrl_message_symkey(OtrlUserState us,
        const OtrlMessageAppOps *ops, void *opdata, ConnContext *context,
        unsigned int use, const unsigned char *usedata, size_t usedatalen,
        unsigned char *symkey);

This callback will be called on the other side:

    /* We received a request from the buddy to use the current "extra"
     * symmetric key.  The key will be passed in symkey, of length
     * OTRL_EXTRAKEY_BYTES.  The requested use, as well as use-specific
     * data will be passed so that the applications can communicate other
     * information (some id for the data transfer, for example). */
    void (*received_symkey)(void *opdata, ConnContext *context,
            unsigned int use, const unsigned char *usedata,
            size_t usedatalen, const unsigned char *symkey);

[OTRL_EXTRAKEY_BYTES is currently 32, so you get 256 bits out of it.]

Paul, is that what you were looking for?

Thanks,

   - Ian



More information about the OTR-dev mailing list