40 BYTE *bufPtr = ( encryptedKey == NULL ) ? NULL : buffer;
44 assert( ( encryptedKey == NULL && encryptedKeyMaxLength == 0 ) || \
45 isWritePtr( encryptedKey, encryptedKeyMaxLength ) );
46 assert(
isWritePtr( encryptedKeyLength,
sizeof(
int ) ) );
48 REQUIRES( ( encryptedKey == NULL && encryptedKeyMaxLength == 0 ) || \
49 ( encryptedKey != NULL && \
60 *encryptedKeyLength = 0;
63 if( writeKeyexFunction == NULL )
75 sMemOpenOpt( &stream, encryptedKey, encryptedKeyMaxLength );
76 status = writeKeyexFunction( &stream, iExportContext, NULL, 0 );
78 *encryptedKeyLength = stell( &stream );
79 sMemDisconnect( &stream );
124 iSessionKeyContext, iExportContext );
133 if( encryptedKey == NULL )
136 sMemOpenOpt( &stream, encryptedKey, encryptedKeyMaxLength );
137 status = writeKeyexFunction( &stream, iExportContext,
138 ( encryptedKey != NULL ) ? \
139 mechanismInfo.wrappedData : buffer,
142 *encryptedKeyLength = stell( &stream );
143 sMemDisconnect( &stream );
155 int exportPublicKey(
OUT_BUFFER_OPT( encryptedKeyMaxLength, *encryptedKeyLength ) \
157 IN_LENGTH const int encryptedKeyMaxLength,
168 BYTE *bufPtr = ( encryptedKey == NULL ) ? NULL : buffer;
172 assert( ( encryptedKey == NULL && encryptedKeyMaxLength == 0 ) || \
173 isWritePtr( encryptedKey, encryptedKeyMaxLength ) );
174 assert(
isWritePtr( encryptedKeyLength,
sizeof(
int ) ) );
175 assert( ( auxInfo == NULL && auxInfoLength == 0 ) || \
178 REQUIRES( ( encryptedKey == NULL && encryptedKeyMaxLength == 0 ) || \
179 ( encryptedKey != NULL && \
184 REQUIRES( ( auxInfo == NULL && auxInfoLength == 0 ) || \
185 ( auxInfo != NULL && \
190 *encryptedKeyLength = 0;
193 if( writeKetransFunction == NULL )
204 iSessionKeyContext, iExportContext );
206 &mechanismInfo, ( keyexType ==
KEYEX_PGP ) ? \
215 if( encryptedKey == NULL )
218 sMemOpenOpt( &stream, encryptedKey, encryptedKeyMaxLength );
219 status = writeKetransFunction ( &stream, iExportContext,
220 ( encryptedKey != NULL ) ? \
221 mechanismInfo.wrappedData : buffer,
223 auxInfo, auxInfoLength );
225 *encryptedKeyLength = stell( &stream );
226 sMemDisconnect( &stream );
244 int importConventionalKey(
IN_BUFFER( encryptedKeyLength ) \
245 const void *encryptedKey,
258 assert(
isReadPtr( encryptedKey, encryptedKeyLength ) );
267 if( readKeyexFunction == NULL )
281 sMemConnect( &stream, encryptedKey, encryptedKeyLength );
282 status = readKeyexFunction( &stream, &queryInfo );
283 sMemDisconnect( &stream );
313 CRYPT_IATTRIBUTE_LOCKED );
319 encryptedKeyLength ) );
323 iSessionKeyContext, iImportContext );
328 CRYPT_IATTRIBUTE_LOCKED );
338 int importPublicKey(
IN_BUFFER( encryptedKeyLength )
const void *encryptedKey,
352 assert(
isReadPtr( encryptedKey, encryptedKeyLength ) );
355 ( keyexType !=
KEYEX_PGP && iReturnedContext == NULL ) );
365 ( keyexType !=
KEYEX_PGP && iReturnedContext == NULL ) );
369 if( iReturnedContext != NULL )
373 if( readKetransFunction == NULL )
377 sMemConnect( &stream, encryptedKey, encryptedKeyLength );
378 status = readKetransFunction( &stream, &queryInfo );
379 sMemDisconnect( &stream );
435 iSessionKeyContext, iImportContext );