From: CarSun C <car...@ya...> - 2011-10-27 23:08:05
|
With pyOpenSSL 0.13, passing a python string with embedded NUL byte(s) to crypto.sign method will generate an error saying "must be string without null bytes, not str". Initially I thought the API is meant to support C-string (NUL-terminated) only, though it isn't explicitly mentioned in the documentation, above error seems to say so. However, looking into the crypto_sign function (within "crypto.c"), that doesn't seem to be the case, as the format string being used (enclosed below) put a "#" right after BYTESTRING_FMT... "O!" BYTESTRING_FMT "#s:sign" Unsurprisingly, once I modify the format string to "O!s#s:sign", signing a python string with embedded NUL byte(s) works perfectly fine. Am I over looking something? or is this a bug? Would appreciate your feedback - c Below is the signature of the sign method sign(key, data, digest) |