File: test_rfc8037.py

package info (click to toggle)
python-authlib 1.6.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 3,024 kB
  • sloc: python: 27,284; makefile: 53; sh: 14
file content (13 lines) | stat: -rw-r--r-- 483 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
from authlib.jose import JsonWebSignature
from tests.util import read_file_path


def test_EdDSA_alg():
    jws = JsonWebSignature(algorithms=["EdDSA"])
    private_key = read_file_path("ed25519-pkcs8.pem")
    public_key = read_file_path("ed25519-pub.pem")
    s = jws.serialize({"alg": "EdDSA"}, "hello", private_key)
    data = jws.deserialize(s, public_key)
    header, payload = data["header"], data["payload"]
    assert payload == b"hello"
    assert header["alg"] == "EdDSA"