Re: Keys and Certificates creations

David Pierre <[email protected]> Fri, 8 Feb 2013 06:30:22 -0800 (PST)
Newsgroups gmane.comp.encryption.cryptlib
Message-ID <[email protected]>
Yes, as I said it's only for test and have some references to choose the way
we will implement our project. Today I face a new problem. My key generation
works fine, but i found something using DSA key. 

If I try to open a TLS session, i got a -20 error code on server side and
-15 on client side. I have created my DSA keys like the RSAs (just modifying
the ALGO_TYPE), and when I create them there is no problem. On server side,
the key also loads well, I just get the error when client attempts a
connection. I saw in manual (p185), that this error means this operation
couldn't be done with this key.

My question is : Is DSA not available at all for TLS session, or did I do
something wrong in my key/cert generation ? 


status = cryptCreateContext( cryptContext, CRYPT_UNUSED, algo ); 
status = cryptSetAttributeString( *cryptContext, CRYPT_CTXINFO_LABEL,
"label", 5 ); 
status = cryptSetAttribute( *cryptContext, CRYPT_CTXINFO_KEYSIZE, keySize /
8 ); 
status = cryptGenerateKey( *cryptContext ); 
status = cryptCreateCert( cryptCertificate,  CRYPT_UNUSED ,
CRYPT_CERTTYPE_CERTIFICATE );
status = cryptSetAttribute( *cryptCertificate, CRYPT_CERTINFO_XYZZY, 1 );
status = cryptSetAttribute( *cryptCertificate,
CRYPT_CERTINFO_SUBJECTPUBLICKEYINFO, *cryptContext );
status = cryptSetAttributeString( *cryptCertificate,
CRYPT_CERTINFO_COMMONNAME, server_address, 13 );
status = cryptSignCert( *cryptCertificate, *cryptContext );
status = cryptKeysetOpen( &cryptKeyset, CRYPT_UNUSED , CRYPT_KEYSET_FILE,
keyname, CRYPT_KEYOPT_CREATE );
status = cryptAddPrivateKey( cryptKeyset, *cryptContext, "test" );
status = cryptAddPublicKey( cryptKeyset, *cryptCertificate );
status = cryptKeysetClose( cryptKeyset );
status = cryptExportCert( NULL, 0, &certMaxLength,
CRYPT_CERTFORMAT_CERTIFICATE, *cryptCertificate );
certificate = malloc( certMaxLength );
status = cryptExportCert( certificate, certMaxLength, &certLength,
CRYPT_CERTFORMAT_CERTIFICATE, *cryptCertificate );
status = cryptDestroyContext( *cryptContext );
status = cryptDestroyCert( *cryptCertificate );
-- 
View this message in context: http://old.nabble.com/Keys-and-Certificates-creations-tp34985397p34999681.html
Sent from the Cryptlib mailing list archive at Nabble.com.


_______________________________________________
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.