def encrypt_header_val(crypto, value, key):
 if (not value):
  raise ValueError('empty value is not acceptable')
 crypto_meta = crypto.create_crypto_meta()
 crypto_ctxt = crypto.create_encryption_ctxt(key, crypto_meta['iv'])
 enc_val = base64.b64encode(crypto_ctxt.update(value))
 return (enc_val, crypto_meta)

def encrypt_header_val ( crypto , value , key ) : if ( not value ) : raise ValueError ( 'empty value is not acceptable' ) crypto_meta = crypto . create_crypto_meta ( ) crypto_ctxt = crypto . create_encryption_ctxt ( key , crypto_meta [ 'iv' ] ) enc_val = base64 . b64encode ( crypto_ctxt . update ( value ) ) return ( enc_val , crypto_meta )
encrypt a header value using the supplied key .