def generate_signature(data, rsa_key):
 import base64
 try:
  from tlslite.utils import keyfactory
 except ImportError:
  from gdata.tlslite.utils import keyfactory
 private_key = keyfactory.parsePrivateKey(rsa_key)
 signed = private_key.hashAndSign(data)
 if hasattr(base64, 'b64encode'):
  return base64.b64encode(signed)
 else:
  return base64.encodestring(signed).replace('\n', '')

def generate_signature ( data , rsa_key ) : import base64 try : from tlslite . utils import keyfactory except ImportError : from gdata . tlslite . utils import keyfactory private_key = keyfactory . parsePrivateKey ( rsa_key ) signed = private_key . hashAndSign ( data ) if hasattr ( base64 , 'b64encode' ) : return base64 . b64encode ( signed ) else : return base64 . encodestring ( signed ) . replace ( '\n' , '' )
signs the data string for a secure authsub request .