コード例 #1
0
def test_missing_key():
    with pytest.raises(FileNotFoundError):
        j = jce.Johnny("missingfile.asc")
コード例 #2
0
def test_sign():
    j = jce.Johnny("tests/files/secret.asc")
    signature = j.sign_bytes_detached(DATA.encode("utf-8"), "redhat")
    assert signature
コード例 #3
0
def test_verify_bytes_must_fail():
    j = jce.Johnny("tests/files/secret.asc")
    signature = j.sign_bytes_detached(DATA.encode("utf-8"), "redhat")
    jp = jce.Johnny("tests/files/public.asc")
    data2 = DATA + " "
    assert not jp.verify_bytes(data2.encode("utf-8"), signature.encode("utf-8"))
コード例 #4
0
def test_sign_fail():
    j = jce.Johnny("tests/files/public.asc")
    with pytest.raises(AttributeError):
        signature = j.sign_bytes_detached(DATA.encode("utf-8"), "redhat")
コード例 #5
0
def test_verify_bytes():
    j = jce.Johnny("tests/files/secret.asc")
    signature = j.sign_bytes_detached(DATA.encode("utf-8"), "redhat")
    jp = jce.Johnny("tests/files/public.asc")
    assert jp.verify_bytes(DATA.encode("utf-8"), signature.encode("utf-8"))