python/pyasn1-modules/pyasn1_modules/rfc5208.py
author Ting-Yu Lin <tlin@mozilla.com>
Mon, 14 Nov 2016 18:11:45 +0800
changeset 324036 aaf70a7cd344ceb7ea9c78d7807bb15283918d0f
parent 246203 580d7094b03a0216a2c8a8e674defe2110a00441
permissions -rw-r--r--
Bug 1316549 Part 2 - Fix assertion failure: aRadiusY > 0 in FloatInfo::XInterceptAtY(). r=dbaron We need to consider the case when only one of the four corner radius is specified. The two reftests are added to test 'border-top-right-radius' and 'border-bottom-right-radius', respectively. MozReview-Commit-ID: De2fXcb6ypP

#
# PKCS#8 syntax
#
# ASN.1 source from:
# http://tools.ietf.org/html/rfc5208
#
# Sample captures could be obtained with "openssl pkcs8 -topk8" command
#
from pyasn1.type import tag, namedtype, namedval, univ, constraint
from pyasn1_modules.rfc2459 import *
from pyasn1_modules import rfc2251

class KeyEncryptionAlgorithms(AlgorithmIdentifier): pass

class PrivateKeyAlgorithms(AlgorithmIdentifier): pass

class EncryptedData(univ.OctetString): pass

class EncryptedPrivateKeyInfo(univ.Sequence):
    componentType = namedtype.NamedTypes(
        namedtype.NamedType('encryptionAlgorithm', AlgorithmIdentifier()),
        namedtype.NamedType('encryptedData', EncryptedData())
    )

class PrivateKey(univ.OctetString): pass

class Attributes(univ.SetOf):
    componentType = rfc2251.Attribute()

class Version(univ.Integer):
    namedValues = namedval.NamedValues(('v1', 0), ('v2', 1)) 

class PrivateKeyInfo(univ.Sequence):
    componentType = namedtype.NamedTypes(
        namedtype.NamedType('version', Version()),
        namedtype.NamedType('privateKeyAlgorithm', AlgorithmIdentifier()),
        namedtype.NamedType('privateKey', PrivateKey()),
        namedtype.OptionalNamedType('attributes', Attributes().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)))
    )