Beispiel #1
0
    def __init__(self, app, passphrase, keyID):
        super(QDialog, self).__init__()
        self.app = app
        self.passphrase = passphrase
        self.keyID = keyID

        # Set up window
        self.ui = Ui_MakeVideoForm()
        self.ui.setupUi(self)

        print(keyID)
        print(public_keys_details())

        # Handle key error here?
        key = public_keys_details()[keyID]
        if not key:
            # Key not found
            self.window.show()
            return

        print(key["uid"])

        name, email = self.extract_name_and_email(key["uid"])

        keyExpiry = key["expires"]
        if keyExpiry == "":
            expiry = "None"
        else:
            expiry = uIntToString(keyExpiry)

        date = uIntToString(key["date"])
        fingerprint = key["fingerprint"]

        print(name)
        print(email)

        self.ui.nameLabel.setText("Name: " + name)
        self.ui.emailLabel.setText("Email: " + email)
        self.ui.expiresLabel.setText("Expiry: " + expiry)
        self.ui.dateLabel.setText("Date: " + date)
        self.ui.fingerprintTextEdit.setText(fingerprint)

        self.ui.importVideoButton.clicked.connect(self.importVideo)
        # Set up connections
        # self.ui.passphraseTextEdit.textChanged.connect(self.passphraseChanged)
        # self.ui.loadKeyButton.clicked.connect(self.loadKeyClicked)

        self.show()
Beispiel #2
0
    def __init__(self, app, vaidaPath):
        super(QDialog, self).__init__()
        
        success, fingerprint, absoluteVideoPath, dateUInt, uid = untar_verify_vaida(vaidaPath)
        
        expirationDate = uIntToString.uIntToString(dateUInt)
        
        if not success:
            self.showMessage("VAIDA verification failed!")
            return
        
        self.ui = Ui_VideoVerificationDialog()
        self.ui.setupUi(self)
        self.app = app
        
        # Set text
        self.ui.fingerprintLabel.setText("Key fingerprint: " + fingerprint)
        self.ui.keyExpirationLabel.setText("Key expiration date: " + expirationDate)
        
        # First name
        name = uid.split("<")[0].strip()
        self.ui.checkBox.setText("Does this look like " + name + "?")
        self.ui.checkBox_2.setText("Does this sound like " + name + "?")

        # Set media
        self.source = Phonon.MediaSource(absoluteVideoPath)
        self.media = Phonon.MediaObject()
        self.media.setCurrentSource(self.source)
        self.video = Phonon.VideoWidget(self.ui.videoPlayerWidget)
        self.video.setMinimumSize(600, 600)
        
        # Scale mode - 0 = do not scale, 1 = scale and crop
        self.video.setScaleMode(Phonon.VideoWidget.ScaleMode(0))
        
        self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self.ui.videoPlayerWidget)
        Phonon.createPath(self.media, self.audio)
        Phonon.createPath(self.media, self.video)

        self.ui.checkBox.stateChanged.connect(self.checkBoxChecked)
        self.ui.checkBox_2.stateChanged.connect(self.checkBoxChecked)
        self.ui.checkBox_3.stateChanged.connect(self.checkBoxChecked)
        self.ui.checkBox_4.stateChanged.connect(self.checkBoxChecked)
        
        self.show()
        self.media.play()
Beispiel #3
0
def verify(file_name):
    if not file_name:
        print ("Please enter a VAIDA file to validate")
        return

    success, fingerprint, absolute_video_path, date_uint, uid = gpglib.untar_verify_vaida(file_name)

    expiration_date = uIntToString.uIntToString(date_uint)

    if not success:
        print ("Verification of VAIDA file failed!")
        return
    
    name = uid.split("<")[0].strip()

    print ("Key fingerprint: " + fingerprint)
    print ("Key expiration date: " + expiration_date)

    subprocess.call(['vlc', absolute_video_path])

    looks_like = "Does this look like " + name
    sounds_like = "Does this sound like " + name
    matching_fingerprints = "Do the key fingerprints match"
    matching_expiration = "Do the key expiration dates match"

    tests = [looks_like, sounds_like, matching_fingerprints, matching_expiration]

    for test in tests:
        while True:
            answer = input (test + "? [yes/no] ")
            if answer == "yes":
                break
            elif answer == "no":
                print ("Verification failed")
                return
            else:
                print ("Please answer 'yes' or 'no'")
    
    print ("Verified")
    try:
        gpglib.add_tmp_to_keyring()
    except GPGException as e:
        print (str(e))
    else:
        print ("Added to keyring")
Beispiel #4
0
def generate():
    while True:
        generate_key_answer = input("Would you like to generate a new gpg key? [yes/no]")
        if generate_key_answer == "yes":
            # Generate
            generate_key()
            break
        elif generate_key_answer == "no":
            # Don't generate - continue
            break
    
    keys_list = []
    keys_dict = gpglib.private_keys_users()
    for key in keys_dict.keys():
        keys_list.append(key)
        print (str(len(keys_list) - 1) + ". " + key)

    while True:
        key_index_str = input("Please enter a key index [0-" + str(len(keys_list)-1) + "] ")
        if not str.isnumeric(key_index_str):
            print ("Please enter a numeric key index")
            continue
        key_index = int(key_index_str)
        if key_index >= len(keys_list) or key_index < 0:
            # Invalid selection
            print ("Key index out of range")
            continue
        else:
            # Key selected
            key_selection = keys_list[key_index]
            break
    
    key_id = keys_dict[key_selection]
    while True:
        passphrase = input ("Please enter the passphrase for " + key_selection + ": ")
        if gpglib.test_passphrase(key_id, passphrase):
            break
        else:
            print ("Incorrect passphrase")

    # Make VAIDA video
    key = gpglib.public_keys_details()[key_id]
    name, email = extract_name_and_email(key['uid'])
    key_expiry = key['expires']
    if key_expiry == '':
        expiry = "None"
    else:
        expiry = uIntToString.uIntToString(key_expiry)
    date = uIntToString.uIntToString(key['date'])
    fingerprint = key['fingerprint']

    print ("---")
    print ("---")
    print ("Details for making your VAIDA video")
    print ("Name: " + name)
    print ("Email: " + email)
    print ("Expiry: " + expiry)
    print ("Date: " + date)
    print ("Fingerprint: " + fingerprint)
    print ("---")
    print ("---")
    
    while True:
        fname = input("Please enter the location of your VAIDA video: ")
        try:
            vaida_path = gpglib.create_vaida(fname, passphrase, key_id)
            break
        except (IOError):
            # TODO
            print ("Please try again - file probably not found")

    print ("VAIDA created at " + vaida_path)