def shaWindow(): sha1 = sha.sha() def chooseFile(var): chosen = filedialog.askopenfilename( initialdir=Constants.DOKUMENTI_PATH) if var == "ulaz": ulazPath.set(chosen) sha1.ulazPath = chosen elif var == "sazetak": sazetakPath.set(chosen) sha1.sazetak_path = chosen window = Toplevel() # prvi red Label(window, text=Constants.ULAZNA_DATOTEKA).grid(row=1, column=1) ulazPath = StringVar() ulazEntry = Entry(window, textvariable=ulazPath, width=75).grid(row=1, column=2) ulazPath.set(Constants.ULAZ_PATH) Button(window, text=Constants.ODABERI, command=lambda: chooseFile("ulaz")).grid(row=1, column=3) Button(window, text=Constants.PREGLEDAJ, command=lambda: fh.openWithNotepad(ulazPath.get())).grid(row=1, column=4) # drugi red Label(window, text=Constants.SAZETAK).grid(row=2, column=1) sazetakPath = StringVar() sazetakEntry = Entry(window, textvariable=sazetakPath, width=75).grid(row=2, column=2) sazetakPath.set(Constants.SAZETAK_PATH) Button(window, text=Constants.ODABERI, command=lambda: chooseFile("sazetak")).grid(row=2, column=3) Button(window, text=Constants.PREGLEDAJ, command=lambda: fh.openWithNotepad(sazetakPath.get())).grid( row=2, column=4) # treci Button(window, text=Constants.GENERIRAJ_SAZETAK, command=sha1.generiraj_sha1).grid(row=3, column=2) Button(window, text=Constants.GENERIRAJ_SAZETAK + ' - MOJ SHA-1', command=sha1.generiraj_moj_sha1).grid(row=3, column=3) # peti Label(window, text=Constants.VLASNIK).grid(row=4, column=4)
def rsaWindow(): RSA = rsa.rsa() def chooseFile(var): chosen = filedialog.askopenfilename(initialdir=Constants.DOKUMENTI_PATH) if var == "kljucTajni": kljucTajniPath.set(chosen) RSA.rsa_tajni = chosen elif var == "kljucJavni": kljucJavniPath.set(chosen) RSA.rsa_javni = chosen window = Toplevel() # prvi red Label(window, text=Constants.TAJNI_KLJUC).grid(row=1, column=1) kljucTajniPath = StringVar() kljucTajniEntry = Entry(window, textvariable=kljucTajniPath, width=75).grid(row=1, column=2) kljucTajniPath.set(Constants.RSA_TAJNI_PATH) Button(window, text=Constants.ODABERI, command=lambda : chooseFile("kljucTajni")).grid(row=1, column=3) Button(window, text=Constants.PREGLEDAJ, command=lambda : fh.openWithNotepad(kljucTajniPath.get())).grid(row=1, column=4) # drugi red Label(window, text=Constants.JAVNI_KLJUC).grid(row=2, column=1) kljucJavniPath = StringVar() kljucJavniEntry = Entry(window, textvariable=kljucJavniPath, width=75).grid(row=2, column=2) kljucJavniPath.set(Constants.RSA_JAVNI_PATH) Button(window, text=Constants.ODABERI, command=lambda : chooseFile("kljucJavni")).grid(row=2, column=3) Button(window, text=Constants.PREGLEDAJ, command=lambda : fh.openWithNotepad(kljucJavniPath.get())).grid(row=2, column=4) # treci keySizeRSA = IntVar() Radiobutton(window, text=Constants.RSA_1024_T, value=Constants.RSA_1024, variable=keySizeRSA).grid(row=3, column=3) Radiobutton(window, text=Constants.RSA_2048_T, value=Constants.RSA_2048, variable=keySizeRSA).grid(row=3, column=4) Radiobutton(window, text=Constants.RSA_4096_T, value=Constants.RSA_4096, variable=keySizeRSA).grid(row=3, column=5) keySizeRSA.set(1024) # cetvrti Button(window, text=Constants.GENERIRAJ_KLJUCEVE, command=lambda : RSA.generiraj_rsa(keySizeRSA.get())).grid(row=4, column=2) # sesto Label(window, text=Constants.VLASNIK).grid(row=6, column=5)
def omotnicaWindow(): omotnica_instance = omotnica.Omotnica() def chooseFile(var): chosen = filedialog.askopenfilename( initialdir=Constants.DOKUMENTI_PATH) if var == "ulaz": ulazPath.set(chosen) omotnica_instance.ulaz_path = chosen elif var == "javniKljuc": javniKljucPath.set(chosen) omotnica_instance.rsa_b_javni = chosen elif var == "omotnica": omotnicaPath.set(chosen) omotnica_instance.omotnica_path = chosen elif var == "tajniKljuc": tajniKljucPath.set(chosen) omotnica_instance.rsa_b_tajni = chosen elif var == "izlaz": izlazPath.set(chosen) omotnica_instance.izlaz_path = chosen window = Toplevel() # prvi redak Label(window, text=Constants.ULAZNA_DATOTEKA).grid(row=1, column=1) ulazPath = StringVar() ulazEntry = Entry(window, textvariable=ulazPath, width=75).grid(row=1, column=2) ulazPath.set(Constants.ULAZ_PATH) Button(window, text=Constants.ODABERI, command=lambda: chooseFile("ulaz")).grid(row=1, column=3) Button(window, text=Constants.PREGLEDAJ, command=lambda: fh.openWithNotepad(ulazPath.get())).grid(row=1, column=4) # drugi redak Label(window, text=Constants.JAVNI_KLJUC_PRIMATELJA).grid(row=2, column=1) javniKljucPath = StringVar() javniKljucEntry = Entry(window, textvariable=javniKljucPath, width=75).grid(row=2, column=2) javniKljucPath.set(Constants.RSA_B_JAVNI_PATH) Button(window, text=Constants.ODABERI, command=lambda: chooseFile("javniKljuc")).grid(row=2, column=3) Button(window, text=Constants.PREGLEDAJ, command=lambda: fh.openWithNotepad(javniKljucPath.get())).grid( row=2, column=4) # treci redak Label(window, text=Constants.TAJNI_KLJUC_PRIMATELJA).grid(row=3, column=1) tajniKljucPath = StringVar() tajniKljucEntry = Entry(window, textvariable=tajniKljucPath, width=75).grid(row=3, column=2) tajniKljucPath.set(Constants.RSA_B_TAJNI_PATH) Button(window, text=Constants.ODABERI, command=lambda: chooseFile("tajniKljuc")).grid(row=3, column=3) Button(window, text=Constants.PREGLEDAJ, command=lambda: fh.openWithNotepad(tajniKljucPath.get())).grid( row=3, column=4) # cetvrti redak Label(window, text=Constants.DIGITALNA_OMOTNICA).grid(row=4, column=1) omotnicaPath = StringVar() omotnicaEntry = Entry(window, textvariable=omotnicaPath, width=75).grid(row=4, column=2) omotnicaPath.set(Constants.OMOTNICA_PATH) Button(window, text=Constants.ODABERI, command=lambda: chooseFile("omotnica")).grid(row=4, column=3) Button(window, text=Constants.PREGLEDAJ, command=lambda: fh.openWithNotepad(omotnicaPath.get())).grid( row=4, column=4) # peti redak Label(window, text=Constants.IZLAZNA_DATOTEKA).grid(row=5, column=1) izlazPath = StringVar() izlazEntry = Entry(window, textvariable=izlazPath, width=75).grid(row=5, column=2) izlazPath.set(Constants.IZLAZ_PATH) Button(window, text=Constants.ODABERI, command=lambda: chooseFile("izlaz")).grid(row=5, column=3) Button(window, text=Constants.PREGLEDAJ, command=lambda: fh.openWithNotepad(izlazPath.get())).grid(row=5, column=4) # sesti redak Button(window, text=Constants.GENERIRAJ_DIGITALNU_OMOTNICU, command=omotnica_instance.generiraj_omotnicu, width=25).grid(row=6, column=2) Button(window, text=Constants.OTVORI_DIGITALNU_OMOTNICU, command=omotnica_instance.otvori_omotnicu, width=25).grid(row=6, column=3) # osmi redak Label(window, text=Constants.VLASNIK).grid(row=7, column=4)
def potpisWindow(): Potpis = potpis.potpis() def chooseFile(var): chosen = filedialog.askopenfilename( initialdir=Constants.DOKUMENTI_PATH) if var == "ulaz": ulazPath.set(chosen) Potpis.ulaz_path = chosen elif var == "tajniKljuc": tajniKljucPath.set(chosen) Potpis.rsa_a_tajni_path = chosen elif var == "potpis": potpisPath.set(chosen) Potpis.potpis_path = chosen elif var == "javniKljuc": javniKljucPath.set(chosen) Potpis.rsa_a_javni_path = chosen elif var == "sazetak": sazetakPath.set(chosen) Potpis.sazetak_path = chosen window = Toplevel() # prvi redak Label(window, text=Constants.ULAZNA_DATOTEKA).grid(row=1, column=1) ulazPath = StringVar() ulazEntry = Entry(window, textvariable=ulazPath, width=75).grid(row=1, column=2) ulazPath.set(Constants.ULAZ_PATH) Button(window, text=Constants.ODABERI, command=lambda: chooseFile("ulaz")).grid(row=1, column=3) Button(window, text=Constants.PREGLEDAJ, command=lambda: fh.openWithNotepad(ulazPath.get())).grid(row=1, column=4) # drugi redak Label(window, text=Constants.TAJNI_KLJUC_POSILJATELJA).grid(row=2, column=1) tajniKljucPath = StringVar() tajniKljucEntry = Entry(window, textvariable=tajniKljucPath, width=75).grid(row=2, column=2) tajniKljucPath.set(Constants.RSA_A_TAJNI_PATH) Button(window, text=Constants.ODABERI, command=lambda: chooseFile("tajniKljuc")).grid(row=2, column=3) Button(window, text=Constants.PREGLEDAJ, command=lambda: fh.openWithNotepad(tajniKljucPath.get())).grid( row=2, column=4) # treci redak Label(window, text=Constants.JAVNI_KLJUC_POSILJATELJA).grid(row=3, column=1) javniKljucPath = StringVar() javniKljucEntry = Entry(window, textvariable=javniKljucPath, width=75).grid(row=3, column=2) javniKljucPath.set(Constants.RSA_A_JAVNI_PATH) Button(window, text=Constants.ODABERI, command=lambda: chooseFile("javniKljuc")).grid(row=3, column=3) Button(window, text=Constants.PREGLEDAJ, command=lambda: fh.openWithNotepad(javniKljucPath.get())).grid( row=3, column=4) # cetvrti redak Label(window, text=Constants.DIGITALNI_POTPIS).grid(row=4, column=1) potpisPath = StringVar() potpisEntry = Entry(window, textvariable=potpisPath, width=75).grid(row=4, column=2) potpisPath.set(Constants.POTPIS_PATH) Button(window, text=Constants.ODABERI, command=lambda: chooseFile("potpis")).grid(row=4, column=3) Button(window, text=Constants.PREGLEDAJ, command=lambda: fh.openWithNotepad(potpisPath.get())).grid(row=4, column=4) # peti redak Label(window, text=Constants.SAZETAK).grid(row=5, column=1) sazetakPath = StringVar() sazetakEntry = Entry(window, textvariable=sazetakPath, width=75).grid(row=5, column=2) sazetakPath.set(Constants.SAZETAK_PATH) Button(window, text=Constants.ODABERI, command=lambda: chooseFile("sazetak")).grid(row=5, column=3) Button(window, text=Constants.PREGLEDAJ, command=lambda: fh.openWithNotepad(sazetakPath.get())).grid( row=5, column=4) # sesti redak Button(window, text=Constants.GENERIRAJ_DIGITALNI_POTPIS, command=Potpis.generiraj_potpis, width=25).grid(row=6, column=2) Button(window, text=Constants.PROVJERI_DIGITALNI_POTPIS, command=Potpis.provjeri_potpis, width=25).grid(row=6, column=3) # sedmi redak Button(window, text=Constants.GENERIRAJ_DIGITALNI_POTPIS + ' - MOJ SHA-1', command=Potpis.generiraj_moj_potpis, width=25).grid(row=7, column=2) Button(window, text=Constants.PROVJERI_DIGITALNI_POTPIS + '- MOJ SHA-1', command=Potpis.provjeri_moj_potpis, width=25).grid(row=7, column=3) # osmi redak Label(window, text=Constants.VLASNIK).grid(row=8, column=4)
def desWindow(): DES = des.des() def chooseFile(var): chosen = filedialog.askopenfilename( initialdir=Constants.DOKUMENTI_PATH) if var == "kljuc": kljucPath.set(chosen) DES.des_kljuc_path = chosen elif var == "ulazDes": ulazAesPath.set(chosen) DES.des_ulaz_path = chosen elif var == "izlazDes": izlazAesPath.set(chosen) DES.des_izlaz_path = chosen window = Toplevel() blokSize = IntVar() blokSize.set(Constants.BLOK_128) # prvi redak Label(window, text=Constants.KLJUC).grid(row=1, column=1) kljucPath = StringVar() kljucEntry = Entry(window, textvariable=kljucPath, width=75).grid(row=1, column=2) kljucPath.set(Constants.DES_KLJUC_PATH) Button(window, text=Constants.ODABERI, command=lambda: chooseFile("kljuc")).grid(row=1, column=3) Button(window, text=Constants.PREGLEDAJ, command=lambda: fh.openWithNotepad(kljucPath.get())).grid(row=1, column=4) Button(window, text=Constants.GENERIRAJ, command=lambda: DES.generiraj_des()).grid(row=1, column=5) # drugi redak Label(window, text=Constants.ULAZNA_DATOTEKA).grid(row=2, column=1) ulazAesPath = StringVar() ulazAesEntry = Entry(window, textvariable=ulazAesPath, width=75).grid(row=2, column=2) ulazAesPath.set(Constants.DES_ULAZ_PATH) Button(window, text=Constants.ODABERI, command=lambda: chooseFile("ulazDes")).grid(row=2, column=3) Button(window, text=Constants.PREGLEDAJ, command=lambda: fh.openWithNotepad(ulazAesPath.get())).grid( row=2, column=4) # treci redak Label(window, text=Constants.IZLAZNA_DATOTEKA).grid(row=3, column=1) izlazAesPath = StringVar() izlazAesEntry = Entry(window, textvariable=izlazAesPath, width=75).grid(row=3, column=2) izlazAesPath.set(Constants.DES_IZLAZ_PATH) Button(window, text=Constants.ODABERI, command=lambda: chooseFile("izlazDes")).grid(row=3, column=3) Button(window, text=Constants.PREGLEDAJ, command=lambda: fh.openWithNotepad(izlazAesPath.get())).grid( row=3, column=4) # peti redak Button(window, text=Constants.KRIPTIRAJ, command=lambda: DES.kriptiraj_des()).grid(row=5, column=2) Button(window, text=Constants.DEKRIPTIRAJ, command=lambda: DES.dekriptiraj_des()).grid(row=5, column=3) # sesti redak Label(window, text=Constants.VLASNIK).grid(row=6, column=5)
def pecatWindow(): Pecat = pecat.pecat() def chooseFile(var): chosen = filedialog.askopenfilename( initialdir=Constants.DOKUMENTI_PATH) if var == "ulaz": ulazPath.set(chosen) Pecat.ulaz_path = chosen elif var == "javniKljucPrimatelja": javniKljucPrimateljaPath.set(chosen) Pecat.rsa_b_javni_path = chosen elif var == "tajniKljucPosiljatelja": tajniKljucPosiljateljaPath.set(chosen) Pecat.rsa_a_tajni_path = chosen elif var == "omotnica": omotnicaPath.set(chosen) Pecat.omotnica_path = chosen elif var == "potpis": pecatPath.set(chosen) Pecat.potpis_path = chosen elif var == "javniKljucPosiljatelja": javniKljucPosiljateljaPath.set(chosen) Pecat.rsa_a_javni_path = chosen elif var == "tajniKljucPrimatelja": tajniKljucPrimateljaPath.set(chosen) Pecat.rsa_b_tajni_path = chosen elif var == "izlaz": izlazPath.set(chosen) Pecat.izlaz_path = chosen elif var == 'sazetak': sazetakPath.set(chosen) Pecat.sazetak = chosen window = Toplevel() # prvi redak Label(window, text=Constants.ULAZNA_DATOTEKA).grid(row=1, column=1) ulazPath = StringVar() ulazEntry = Entry(window, textvariable=ulazPath, width=75).grid(row=1, column=2) ulazPath.set(Constants.ULAZ_PATH) Button(window, text=Constants.ODABERI, command=lambda: chooseFile("ulaz")).grid(row=1, column=3) Button(window, text=Constants.PREGLEDAJ, command=lambda: fh.openWithNotepad(ulazPath.get())).grid(row=1, column=4) # drugi redak Label(window, text=Constants.JAVNI_KLJUC_PRIMATELJA).grid(row=2, column=1) javniKljucPrimateljaPath = StringVar() javniKljucPrimateljaEntry = Entry(window, textvariable=javniKljucPrimateljaPath, width=75).grid(row=2, column=2) javniKljucPrimateljaPath.set(Constants.RSA_B_JAVNI_PATH) Button(window, text=Constants.ODABERI, command=lambda: chooseFile("javniKljucPrimatelja")).grid(row=2, column=3) Button(window, text=Constants.PREGLEDAJ, command=lambda: fh.openWithNotepad(javniKljucPosiljateljaPath.get()) ).grid(row=2, column=4) # treci redak Label(window, text=Constants.TAJNI_KLJUC_PRIMATELJA).grid(row=3, column=1) tajniKljucPrimateljaPath = StringVar() tajniKljucPrimateljaEntry = Entry(window, textvariable=tajniKljucPrimateljaPath, width=75).grid(row=3, column=2) tajniKljucPrimateljaPath.set(Constants.RSA_B_TAJNI_PATH) Button(window, text=Constants.ODABERI, command=lambda: chooseFile("tajniKljucPrimatelja")).grid(row=3, column=3) Button(window, text=Constants.PREGLEDAJ, command=lambda: fh.openWithNotepad(tajniKljucPrimateljaPath.get()) ).grid(row=3, column=4) # cetvrti redak Label(window, text=Constants.JAVNI_KLJUC_POSILJATELJA).grid(row=4, column=1) javniKljucPosiljateljaPath = StringVar() javniKljucPosiljateljaEntry = Entry( window, textvariable=javniKljucPosiljateljaPath, width=75).grid(row=4, column=2) javniKljucPosiljateljaPath.set(Constants.RSA_A_JAVNI_PATH) Button(window, text=Constants.ODABERI, command=lambda: chooseFile("javniKljucPosiljatelja")).grid(row=4, column=3) Button(window, text=Constants.PREGLEDAJ, command=lambda: fh.openWithNotepad(javniKljucPosiljateljaPath.get()) ).grid(row=4, column=4) # peti redak Label(window, text=Constants.TAJNI_KLJUC_POSILJATELJA).grid(row=5, column=1) tajniKljucPosiljateljaPath = StringVar() tajniKljucPosiljateljaEntry = Entry( window, textvariable=tajniKljucPosiljateljaPath, width=75).grid(row=5, column=2) tajniKljucPosiljateljaPath.set(Constants.RSA_A_TAJNI_PATH) Button(window, text=Constants.ODABERI, command=lambda: chooseFile("tajniKljucPosiljatelja")).grid(row=5, column=3) Button(window, text=Constants.PREGLEDAJ, command=lambda: fh.openWithNotepad(tajniKljucPosiljateljaPath.get()) ).grid(row=5, column=4) # sesti redak Label(window, text=Constants.DIGITALNA_OMOTNICA).grid(row=6, column=1) omotnicaPath = StringVar() omotnicaEntry = Entry(window, textvariable=omotnicaPath, width=75).grid(row=6, column=2) omotnicaPath.set(Constants.OMOTNICA_PATH) Button(window, text=Constants.ODABERI, command=lambda: chooseFile("omotnica")).grid(row=6, column=3) Button(window, text=Constants.PREGLEDAJ, command=lambda: fh.openWithNotepad(omotnicaPath.get())).grid( row=6, column=4) # sedmi redak Label(window, text=Constants.DIGITALNI_POTPIS).grid(row=7, column=1) pecatPath = StringVar() pecatEntry = Entry(window, textvariable=pecatPath, width=75).grid(row=7, column=2) pecatPath.set(Constants.POTPIS_PATH) Button(window, text=Constants.ODABERI, command=lambda: chooseFile("potpis")).grid(row=7, column=3) Button(window, text=Constants.PREGLEDAJ, command=lambda: fh.openWithNotepad(pecatPath.get())).grid(row=7, column=4) # osmi redak Label(window, text=Constants.IZLAZNA_DATOTEKA).grid(row=8, column=1) izlazPath = StringVar() izlazEntry = Entry(window, textvariable=izlazPath, width=75).grid(row=8, column=2) izlazPath.set(Constants.IZLAZ_PATH) Button(window, text=Constants.ODABERI, command=lambda: chooseFile("izlaz")).grid(row=8, column=3) Button(window, text=Constants.PREGLEDAJ, command=lambda: fh.openWithNotepad(izlazPath.get())).grid(row=8, column=4) # peti redak Label(window, text=Constants.SAZETAK).grid(row=9, column=1) sazetakPath = StringVar() sazetakEntry = Entry(window, textvariable=sazetakPath, width=75).grid(row=9, column=2) sazetakPath.set(Constants.SAZETAK_PATH) Button(window, text=Constants.ODABERI, command=lambda: chooseFile("sazetak")).grid(row=9, column=3) Button(window, text=Constants.PREGLEDAJ, command=lambda: fh.openWithNotepad(sazetakPath.get())).grid( row=9, column=4) # sesti redak Button(window, text=Constants.GENERIRAJ_DIGITALNI_POTPIS, command=Pecat.generiraj_pecat, width=25).grid(row=10, column=2) Button(window, text=Constants.PROVJERI_DIGITALNI_POTPIS, command=Pecat.otvori_pecat, width=25).grid(row=10, column=3) # sedmi redak Button(window, text=Constants.GENERIRAJ_DIGITALNI_POTPIS + ' - MOJ SHA-1', command=Pecat.generiraj_moj_pecat, width=25).grid(row=11, column=2) Button(window, text=Constants.PROVJERI_DIGITALNI_POTPIS + '- MOJ SHA-1', command=Pecat.otvori_moj_pecat, width=25).grid(row=11, column=3) # osmi redak Label(window, text=Constants.VLASNIK).grid(row=12, column=4)