Debian Codegraph @

lib/Crypto/Util/asn1.pyi

raw symbols SCIP
1 from typing import Optional, Sequence, Union, Set, Iterable
2
3 __all__ = ['DerObject', 'DerInteger', 'DerOctetString', 'DerNull',
4 'DerSequence', 'DerObjectId', 'DerBitString', 'DerSetOf']
5
6 # TODO: Make the encoded DerObjects their own type, so that DerSequence and
7 # DerSetOf can check their contents better
8
9 class BytesIO_EOF:
10 def __init__(self, initial_bytes: bytes) -> None: ...
11 def set_bookmark(self) -> None: ...
12 def data_since_bookmark(self) -> bytes: ...
13 def remaining_data(self) -> int: ...
14 def read(self, length: int) -> bytes: ...
15 def read_byte(self) -> bytes: ...
16
17 class DerObject:
18 payload: bytes
19 def __init__(self, asn1Id: Optional[int]=None, payload: Optional[bytes]=..., implicit: Optional[int]=None,
20 constructed: Optional[bool]=False, explicit: Optional[int]=None) -> None: ...
21 def encode(self) -> bytes: ...
22 def decode(self, der_encoded: bytes, strict: bool=...) -> DerObject: ...
23
24 class DerInteger(DerObject):
25 value: int
26 def __init__(self, value: Optional[int]= 0, implicit: Optional[int]=None, explicit: Optional[int]=None) -> None: ...
27 def encode(self) -> bytes: ...
28 def decode(self, der_encoded: bytes, strict: bool=...) -> DerInteger: ...
29
30 class DerBoolean(DerObject):
31 value: bool
32 def __init__(self, value: bool=..., implicit: Optional[Union[int, bytes]]=..., explicit: Optional[Union[int, bytes]]=...) -> None: ...
33 def encode(self) -> bytes: ...
34 def decode(self, der_encoded: bytes, strict: bool=...) -> DerBoolean: ...
35
36 class DerSequence(DerObject):
37 def __init__(self, startSeq: Optional[Sequence[Union[int, DerInteger, DerObject]]]=None, implicit: Optional[int]=None) -> None: ...
38 def __delitem__(self, n: int) -> None: ...
39 def __getitem__(self, n: int) -> None: ...
40 def __setitem__(self, key: int, value: DerObject) -> None: ...
41 def __setslice__(self, i: int, j: int, sequence: Sequence) -> None: ...
42 def __delslice__(self, i: int, j: int) -> None: ...
43 def __getslice__(self, i: int, j: int) -> DerSequence: ...
44 def __len__(self) -> int: ...
45 def __iadd__(self, item: DerObject) -> DerSequence: ...
46 def append(self, item: DerObject) -> DerSequence: ...
47 def hasInts(self, only_non_negative: Optional[bool]=True) -> int: ...
48 def hasOnlyInts(self, only_non_negative: Optional[bool]=True) -> bool: ...
49 def encode(self) -> bytes: ...
50 def decode(self, der_encoded: bytes, strict: bool=..., nr_elements: Optional[int]=None, only_ints_expected: Optional[bool]=False) -> DerSequence: ...
51
52 class DerOctetString(DerObject):
53 payload: bytes
54 def __init__(self, value: Optional[bytes]=..., implicit: Optional[int]=None) -> None: ...
55
56 class DerNull(DerObject):
57 def __init__(self) -> None: ...
58
59 class DerObjectId(DerObject):
60 value: str
61 def __init__(self, value: Optional[str]=..., implicit: Optional[int]=None, explicit: Optional[int]=None) -> None: ...
62 def encode(self) -> bytes: ...
63 def decode(self, der_encoded: bytes, strict: bool=...) -> DerObjectId: ...
64
65 class DerBitString(DerObject):
66 value: bytes
67 def __init__(self, value: Optional[bytes]=..., implicit: Optional[int]=None, explicit: Optional[int]=None) -> None: ...
68 def encode(self) -> bytes: ...
69 def decode(self, der_encoded: bytes, strict: bool=...) -> DerBitString: ...
70
71 DerSetElement = Union[bytes, int]
72
73 class DerSetOf(DerObject):
74 def __init__(self, startSet: Optional[Set[DerSetElement]]=None, implicit: Optional[int]=None) -> None: ...
75 def __getitem__(self, n: int) -> DerSetElement: ...
76 def __iter__(self) -> Iterable: ...
77 def __len__(self) -> int: ...
78 def add(self, elem: DerSetElement) -> None: ...
79 def decode(self, der_encoded: bytes, strict: bool=...) -> DerObject: ...
80 def encode(self) -> bytes: ...