File: base.pyi

package info (click to toggle)
typeshed 0.0~git20221107.4f381af-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 18,036 kB
  • sloc: python: 3,216; sh: 62; makefile: 13
file content (23 lines) | stat: -rw-r--r-- 1,042 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from _typeshed import Self
from typing import Any

class Key:
    # Enable when we can use stubs from installed dependencies,
    # as `key` can be of type cryptography.x509.base.Certificate:
    # from cryptography.x509 import Certificate
    def __init__(self, key, algorithm) -> None: ...
    def sign(self, msg: bytes) -> bytes: ...
    def verify(self, msg: bytes, sig: bytes) -> bool: ...
    def public_key(self: Self) -> Self: ...
    def to_pem(self) -> bytes: ...
    def to_dict(self) -> dict[str, Any]: ...
    def encrypt(self, plain_text: str | bytes, aad: bytes | None = ...) -> tuple[bytes, bytes, bytes | None]: ...
    def decrypt(
        self, cipher_text: str | bytes, iv: str | bytes | None = ..., aad: bytes | None = ..., tag: bytes | None = ...
    ) -> bytes: ...
    def wrap_key(self, key_data: bytes) -> bytes: ...
    def unwrap_key(self, wrapped_key: bytes) -> bytes: ...

class DIRKey(Key):
    def __init__(self, key_data: str | bytes, algorithm: str) -> None: ...
    def to_dict(self) -> dict[str, Any]: ...