File: test_rfc8037.py

package info (click to toggle)
python-authlib 1.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,016 kB
  • sloc: python: 26,998; makefile: 53; sh: 14
file content (16 lines) | stat: -rw-r--r-- 576 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import unittest

from authlib.jose import JsonWebSignature
from tests.util import read_file_path


class EdDSATest(unittest.TestCase):
    def test_EdDSA_alg(self):
        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"