Python example on page 68 of the manual.pdf
aryoo <[email protected]>
| Newsgroups | gmane.comp.encryption.cryptlib |
|---|---|
| Message-ID | <[email protected]> |
Dear list,
I am a newbie in the field. Sorry in advance for the stupid questions.
I would like to run the Python example on page 68 of the manual.
Please find it copied below.
If executed as is, the error message is (of course):
bytesCopied = cryptPopData( cryptEnvelope, envelopedData,
envelopedDataBufferSize )
NameError: name 'envelopedData' is not defined
if I initialize envelopedData and envelopedDataBufferSize with:
envelopedData = ""
envelopedDataBufferSize = 1
The error message becomes:
bytesCopied = cryptPopData( cryptEnvelope, envelopedData,
envelopedDataBufferSize )
TypeError: Cannot use string as modifiable buffer
And if I initialize envelopedData with None, the error message is:
bytesCopied = cryptPopData( cryptEnvelope, envelopedData,
envelopedDataBufferSize )
cryptlib_py.CryptException: (-2, 'Bad argument, parameter 2')
Any help with this would be greatly appreciated.
Aryé.
from cryptlib_py import *
cryptInit()
# Create the envelope
cryptUser = CRYPT_UNUSED
cryptEnvelope = cryptCreateEnvelope( cryptUser, CRYPT_FORMAT_CRYPTLIB )
# Add the data size information and data, wrap up the processing, and
# pop out the processed data
message = "Hello world"
cryptEnvelope.ENVINFO_DATASIZE = len( message )
bytesCopied = cryptPushData( cryptEnvelope, message )
cryptFlushData( cryptEnvelope )
bytesCopied = cryptPopData( cryptEnvelope, envelopedData,
envelopedDataBufferSize )
# Destroy the envelope
cryptDestroyEnvelope( cryptEnvelope )
cryptEnd()
_______________________________________________
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.