Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/pyasn1_modules/rfc5208.py: 100%
18 statements
« prev ^ index » next coverage.py v7.3.2, created at 2023-12-08 06:51 +0000
« prev ^ index » next coverage.py v7.3.2, created at 2023-12-08 06:51 +0000
1#
2# This file is part of pyasn1-modules software.
3#
4# Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
5# License: http://snmplabs.com/pyasn1/license.html
6#
7# PKCS#8 syntax
8#
9# ASN.1 source from:
10# http://tools.ietf.org/html/rfc5208
11#
12# Sample captures could be obtained with "openssl pkcs8 -topk8" command
13#
14from pyasn1_modules import rfc2251
15from pyasn1_modules.rfc2459 import *
18class KeyEncryptionAlgorithms(AlgorithmIdentifier):
19 pass
22class PrivateKeyAlgorithms(AlgorithmIdentifier):
23 pass
26class EncryptedData(univ.OctetString):
27 pass
30class EncryptedPrivateKeyInfo(univ.Sequence):
31 componentType = namedtype.NamedTypes(
32 namedtype.NamedType('encryptionAlgorithm', AlgorithmIdentifier()),
33 namedtype.NamedType('encryptedData', EncryptedData())
34 )
37class PrivateKey(univ.OctetString):
38 pass
41class Attributes(univ.SetOf):
42 componentType = rfc2251.Attribute()
45class Version(univ.Integer):
46 namedValues = namedval.NamedValues(('v1', 0), ('v2', 1))
49class PrivateKeyInfo(univ.Sequence):
50 componentType = namedtype.NamedTypes(
51 namedtype.NamedType('version', Version()),
52 namedtype.NamedType('privateKeyAlgorithm', AlgorithmIdentifier()),
53 namedtype.NamedType('privateKey', PrivateKey()),
54 namedtype.OptionalNamedType('attributes', Attributes().subtype(
55 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)))
56 )