-
Notifications
You must be signed in to change notification settings - Fork 12
/
schemas.py
82 lines (70 loc) · 1.57 KB
/
schemas.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
from pyderasn import Sequence, OctetString, ObjectIdentifier, Any, Integer, BitString, tag_ctxc
class CPParamsValue(Sequence):
schema = (
("salt", OctetString()),
("iters", Integer())
)
class CPParams(Sequence):
schema = (
("algo", ObjectIdentifier()),
("params", CPParamsValue())
)
class CPKeyBag(Sequence):
schema = (
("bagParams", CPParams()),
("bagValue", OctetString())
)
class CPBlob(Sequence):
schema = (
("version", Integer()),
("notused", Any()),
("value", OctetString()),
("notused2", Any(optional=True))
)
class CPExportBlobCek(Sequence):
schema = (
("enc", OctetString()),
("mac", OctetString())
)
class PrivateKeyParameters(Sequence):
schema = (
("curve", ObjectIdentifier()),
("digest", ObjectIdentifier()),
)
class PrivateKeyAlgorithm(Sequence):
schema = (
("algorithm", ObjectIdentifier()),
("params", PrivateKeyParameters())
)
class PrivateKeyInfo(Sequence):
schema = (
("version", BitString()),
("privateKeyAlgorithm", PrivateKeyAlgorithm(impl=tag_ctxc(0)))
)
class CPExportBlob2(Sequence):
schema = (
("ukm", OctetString()),
("cek", CPExportBlobCek()),
("oids", PrivateKeyInfo(impl=tag_ctxc(0)))
)
class CPExportBlob(Sequence):
schema = (
("value", CPExportBlob2()),
("notused", OctetString())
)
class PKeyOIDs(Sequence):
schema = (
("param", ObjectIdentifier()),
("dgst", ObjectIdentifier())
)
class PKeyPub(Sequence):
schema = (
("pubalgo", ObjectIdentifier()),
("params", PKeyOIDs())
)
class PKey(Sequence):
schema = (
("version", Integer(0)),
("params", PKeyPub()),
("key", OctetString())
)