Beispiel #1
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 #2
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")