<s> """<STR_LIT>""" <EOL> import nss . nss <EOL> nss . nss . nss_init_nodb ( ) <EOL> _mech = nss . nss . CKM_AES_CBC_PAD <EOL> _iv = '<STR_LIT>' * nss . nss . get_iv_length ( _mech ) <EOL> def aesEncrypt ( data , key ) : <EOL> slot = nss . nss . get_best_slot ( _mech ) <EOL> key_obj = nss . nss . import_sym_key ( slot , _mech , nss . nss . PK11_OriginGenerated , <EOL> nss . nss . CKA_ENCRYPT , nss . nss . SecItem ( key ) ) <EOL> param = nss . nss . param_from_iv ( _mech , nss . nss . SecItem ( _iv ) ) <EOL> ctx = nss . nss . create_context_by_sym_key ( _mech , nss . nss . CKA_ENCRYPT , key_obj , <EOL> param ) <EOL> l1 = ctx . cipher_op ( data ) <EOL> l2 = ctx . digest_final ( ) <EOL> return l1 + l2 <EOL> def aesDecrypt ( data , key ) : <EOL> slot = nss . nss . get_best_slot ( _mech ) <EOL> key_obj = nss . nss . import_sym_key ( slot , _mech , nss . nss . PK11_OriginGenerated , <EOL> nss . nss . CKA_DECRYPT , nss . nss . SecItem ( key ) ) <EOL> param = nss . nss . param_from_iv ( _mech , nss . nss . SecItem ( _iv ) ) <EOL> ctx = nss . nss . create_context_by_sym_key ( _mech , nss . nss . CKA_DECRYPT , key_obj , <EOL> param ) <EOL> l1 = ctx . cipher_op ( data ) <EOL> l2 = ctx . digest_final ( ) <EOL> return l1 + l2 <EOL> def getKeyLength ( ) : <EOL> return <NUM_LIT:32> </s>
