Example #1
0
                        def process_row(empty):

                            if len(rows) < 1:
                                return_d.callback(True)
                                return

                            row = rows.pop(0)
                            db_user, db_user_type, db_password_encrypted = row

                            if db_user_type not in user_types:
                                process_row(None)
                                return  # next loop

                            db_password_clear = rsa_decrypt(
                                private_key, db_password_encrypted)

                            db_password_new_encrypted = rsa_encrypt(
                                public2_key, db_password_clear)

                            ins_q = "INSERT INTO tbl_keychain (user_id, db_name, db_user, db_user_type, db_password_encrypted) VALUES ((SELECT id_user FROM tbl_users WHERE username = %s), %s, %s, %s, %s)"
                            ins_p = [
                                to_user, db_name, db_user, db_user_type,
                                db_password_new_encrypted
                            ]

                            conn.runOperation(ins_q, ins_p).addCallbacks(
                                process_row, return_d.errback)
Example #2
0
                def got_keys_cb(keys):
                    logging.debug("indx_pg2 lookup_best_acct got_keys_cb")

                    # now row is the best account
                    db_user, db_user_type, db_password_encrypted = row
                    db_pass = rsa_decrypt(keys['private'], db_password_encrypted)
                    result_d.callback((db_user, db_pass))
                    return
Example #3
0
                def got_keys_cb(keys):
                    logging.debug("indx_pg2 lookup_best_acct got_keys_cb")

                    # now row is the best account
                    db_user, db_user_type, db_password_encrypted = row
                    db_pass = rsa_decrypt(keys['private'], db_password_encrypted)
                    result_d.callback((db_user, db_pass))
                    return
Example #4
0
                        def process_row(empty):

                            if len(rows) < 1:
                                return_d.callback(True)
                                return

                            row = rows.pop(0)
                            db_user, db_user_type, db_password_encrypted = row

                            if db_user_type not in user_types:
                                process_row(None)
                                return # next loop

                            db_password_clear = rsa_decrypt(private_key, db_password_encrypted)

                            db_password_new_encrypted = rsa_encrypt(public2_key, db_password_clear)

                            ins_q = "INSERT INTO tbl_keychain (user_id, db_name, db_user, db_user_type, db_password_encrypted) VALUES ((SELECT id_user FROM tbl_users WHERE username = %s), %s, %s, %s, %s)"
                            ins_p = [to_user, db_name, db_user, db_user_type, db_password_new_encrypted]

                            conn.runOperation(ins_q, ins_p).addCallbacks(process_row, return_d.errback)