Re: Problems with token and rsa and possible bug with cryptAddPrivateKey

JexMcByte <[email protected]> Thu, 26 Jul 2012 17:06:30 -0700 (PDT)
Newsgroups gmane.comp.encryption.cryptlib
Message-ID <[email protected]>
More progress.
	res = cryptGetPublicKey( cryptDevice, &devicePubKey, CRYPT_KEYID_NAME,
label ); // ok
	res = cryptGetPrivateKey( cryptDevice, &devicePrivKey, CRYPT_KEYID_NAME,
label, NULL ); // ok

	res = cryptCreateSession( &cryptSession, CRYPT_UNUSED,
CRYPT_SESSION_SSL_SERVER );
	res = cryptSetAttribute( cryptSession, CRYPT_SESSINFO_PRIVATEKEY,
privateKey );

cryptSetAttribute status is -3

I'm basing yself on the manual, SSecure Sessions, page 102

Jacques


JexMcByte wrote:
> 
> Some advancement
> 	res = cryptSetAttributeString( cryptDevice, CRYPT_DEVINFO_AUTHENT_USER,
> "somepwd", pwdlen );
> 
> 	...
> 
> 	res = cryptSetAttributeString( cryptDeviceContext, CRYPT_CTXINFO_LABEL,
> label, labellen );
> 
> 	res = cryptGenerateKey( cryptDeviceContext ); // ok
> 
> 	res = cryptGetPublicKey( cryptDevice, &devicePubKey, CRYPT_KEYID_NAME,
> label ); // -43
> 	res = cryptGetPrivateKey( cryptDevice, &devicePrivKey, CRYPT_KEYID_NAME,
> label, NULL ); // -43
> 
> Jacques
> 
> 
> JexMcByte wrote:
>> 
>> cryptLogin fails with INTERNAL_ERROR at cryptapi.c line 1872
>> The token has been  initialised using the provided tool.
>> 
>> Regarding the possible bug with cryptAddPrivateKey, where you able to
>> simulate it ?
>> 
>> Jacques
>> 
>> 
>> Peter Gutmann wrote:
>>> 
>>> JexMcByte <[email protected]> writes:
>>> 
>>>>I've tryed in different ways to get a public/private keypair inside a
token
>>>>but, so far, without any luck
>>>>
>>>>1) crreating the keykair:
>>>>
>>>>        res = cryptDeviceOpen( &cryptDevice, CRYPT_UNUSED,
>>>> CRYPT_DEVICE_PKCS11, "[Autodetect]" );
>>>>        res = cryptDeviceCreateContext( cryptDevice,
>>>> &cryptDeviceContext, CRYPT_ALGO_RSA );
>>>>[...]
>>>>
>>>>final return is CRYPT_ERROR_NOTINITED
>>> 
>>> You haven't logged onto the device or, possibly even initialised it. 
>>> Thus
>>> cryptlib is returning CRYPT_ERROR_NOTINITED.
>>> 
>>> Peter.
>>> 
>>> _______________________________________________
>>> 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.
>>> 
>>> 
>> 
> 
-- 
View this message in context: http://old.nabble.com/Problems-with-token-and-rsa-and-possible-bug-with-cryptAddPrivateKey-tp34216174p34218390.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.