Error setting CRYPT_KEYINFO_QUERY attribute string
Fred MAISON <[email protected]> Tue, 19 Mar 2013 11:59:18 +0100
| Newsgroups | gmane.comp.encryption.cryptlib |
|---|---|
| Message-ID | <1363690758.1427.14.camel@T410FMA> |
Hi all,
While trying to load a pkcs12 file keyset, I got a param2 error while
setting CRYPT_KEYINFO_QUERY attribute string.
Can you tell what is incorrect ?
/* opening the keyset is OK */
puts( "\nfopen CAfileName :" );
if( ( filePtr = fopen( CAfileName, "rb" ) ) == NULL )
return( CRYPT_ERROR_OPEN );
count = fread( buffer, 1, BUFFER_SIZE, filePtr );
fclose( filePtr );
if( count == BUFFER_SIZE ) /* Item too large for buffer */
return( CRYPT_ERROR_OVERFLOW );
printf("%s loaded. length : %d\n", CAfileName, count);
puts( "cryptKeysetOpen CAfileName : ");
status = cryptKeysetOpen( &CAkeyset, CRYPT_UNUSED,
CRYPT_KEYSET_FILE, CAfileName,
CRYPT_KEYOPT_READONLY );
if( cryptStatusError( status ) )
{
printf( "cryptKeysetOpen failed with %d \n", status );
printCryptError( status );
}
if( cryptStatusOK( status ) )
{
printf( "cryptKeysetOpen succeed with %d \n", status );
}
/* NO PROBLEM until now */
/* HERE is the problem : */
puts( "cryptSetAttributeString CRYPT_KEYINFO_QUERY :" );
status = cryptSetAttributeString( CAkeyset,
CRYPT_KEYINFO_QUERY,
TEXT( "$CN='PMUlabXCA2048'" ),
paramStrlen( TEXT( "$CN='PMUlabXCA2048'" ) ) );
if( cryptStatusError( status ) )
{
printf( "cryptSetAttributeString failed with %d \n", status );
printCryptError( status );
}
else
{
puts("cryptSetAttributeString OK");
}
Here is the run result :
fopen CAfileName :
./certs/PMUlabXCA2048.p12 loaded. length : 2524
cryptKeysetOpen CAfileName :
cryptKeysetOpen succeed with 0
cryptSetAttributeString CRYPT_KEYINFO_QUERY :
cryptSetAttributeString failed with -2
CRYPT_ERROR_PARAM2 (-2)
Best regards,
Fred
_______________________________________________
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.