Anonymous DH key agreement problem

Shivam Patel <[email protected]>
Newsgroups gmane.comp.encryption.cryptlib
Message-ID <[email protected]>
Hi Peter,
I want to do a DH key agreement between two peers and I referred to your
sample code at Pg. 193 of manual.pdf.

In the following code, the cryptExportKey() function returns a error code of
-11.
If I remove the comments at line 4 and 5 (these two lines are not required
though), cryptExportKey() returns an error code of -4.

Please let me know whats amiss here !!
As per my understanding, we should be able to export (and import) DH
components without creating certificates.


  status = cryptInit();

  status = cryptCreateContext(&dhContext, cryptUser, CRYPT_ALGO_DH);
  // 4> cryptSetAttributeString( dhContext, CRYPT_CTXINFO_LABEL, "dh key",
6);
  // 5> cryptGenerateKey(dhContext);

  /* Create the key template */
  status = cryptCreateContext( &cryptContext, cryptUser, CRYPT_ALGO_BLOWFISH
);

  cryptSetAttribute( cryptContext, CRYPT_CTXINFO_MODE, CRYPT_MODE_CFB );
  /* Export the key using the template */
  status = cryptExportKey( encryptedKey, 4096, &encryptedKeyLength,
dhContext, cryptContext );
*  printf("\n cryptExportKey RC:%d", status);*

cryptDestroyContext( cryptContext );

_______________________________________________
Cryptlib mailing list
[email protected] via Mail: [email protected]
Archive: ftp://ftp.franken.de/pub/crypt/cryptlib/archives/
http://news.gmane.org/gmane.comp.encryption.cryptlib
Posts from non-subscribed addresses are blocked to prevent spam, please
subscribe in order to post messages.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.