[Twisted-Python] BananaError "longer than 64 bytes worth of prefix"

Vincent Cate vince6 at offshore.ai
Sat Feb 3 21:09:10 MST 2007


If I Jelly/Banana a 384 bit RSA key, all is fine.  But if I do 1024 bit
key it complains with:

  File "/usr/lib/python2.4/site-packages/twisted/spread/banana.py", line
138, in dataReceived
    raise BananaError("Security precaution: longer than 64 bytes worth
of prefix")
twisted.spread.banana.BananaError: Security precaution: longer than 64
bytes worth of prefix

Code to show problem is below.   It seems like banana does not believe
anyone would want numbers taking up more than 64 bytes, but for RSA keys
such numbers are common.  Should I be doing something different?  

   -- Vince


#!/usr/bin/python

from Crypto.PublicKey import RSA
from os import urandom
from twisted.spread import banana,jelly

# works for 384 bit RSA keys but not 1024
def JellyKeyTest(size):
    print "KeyTest with size=",size
    RSAkey = RSA.generate(size, urandom)   
    mykeyserial=banana.encode(jelly.jelly(RSAkey))
    RSAkey=jelly.unjelly(banana.decode(mykeyserial))  

JellyKeyTest(384)
JellyKeyTest(1024)








More information about the Twisted-Python mailing list