[xmlsec] MSCrypto driver, how the crypto works? (ciphers.c)

Olger Warnier olger at xs4all.nl
Tue Apr 22 09:55:25 PDT 2003


Hi List,

For the support of the MSCrypto in the library I have a question on the
way the crypto functions work.

When you have the xmlSecMSCryptoBlockCipherExecute(xmlSecTransformPtr
transform, int last, xmlSecTransformCtxPtr transformCtx) function (as
defined in the Klass file) todo the actual crypto, it calls the:
xmlSecMSCryptoBlockCipherCtxUpdate(xmlSecMSCryptoBlockCipherCtxPtr ctx,
				  xmlSecBufferPtr in, xmlSecBufferPtr out,
				  int encrypt,
				  const xmlChar* cipherName,
				  xmlSecTransformCtxPtr transformCtx)
function for the actual crypto. (copied the design as found in the openssl
or gnutls drivers)

I wonder if the Execute (and Update) functions are called multiple times
depending on the blocksize ? (or is the function always called with the
full content to be encrypted ?
And when the content is the last piece Execute will probably call the
xmlSecMSCryptoBlockCipherCtxFinal function ?

Could someone clarify this a bit ?

Next to that, the MSCrypto CryptEncrypt function only uses one buffer,
this buffer is the in buffer and overwritten with the result. Another
parameter will give you the new size of this buffer.
Probably I need to copy the full content of the inbuffer to the outbuffer
and encrypt that. Any other suggestions ? (and has this an effect on the
way the 'last' block is known?)

I can always provide more information if that is useful.

Kind Regards,

Olger





More information about the xmlsec mailing list