1# coding: utf-8 2# 3# This file is part of pyasn1-modules software. 4# 5# Created by Joel Johnson with asn1ate tool. 6# Modified by Russ Housley to add support for opentypes by importing 7# definitions from rfc5280 so that the same maps are used. 8# 9# Copyright (c) 2005-2019, Ilya Etingof <[email protected]> 10# License: http://snmplabs.com/pyasn1/license.html 11# 12# PKCS #10: Certification Request Syntax Specification 13# 14# ASN.1 source from: 15# https://www.rfc-editor.org/rfc/rfc2986.txt 16# 17from pyasn1.type import namedtype 18from pyasn1.type import tag 19from pyasn1.type import univ 20 21from pyasn1_modules import rfc5280 22 23MAX = float('inf') 24 25 26AttributeType = rfc5280.AttributeType 27 28AttributeValue = rfc5280.AttributeValue 29 30AttributeTypeAndValue = rfc5280.AttributeTypeAndValue 31 32Attribute = rfc5280.Attribute 33 34RelativeDistinguishedName = rfc5280.RelativeDistinguishedName 35 36RDNSequence = rfc5280.RDNSequence 37 38Name = rfc5280.Name 39 40AlgorithmIdentifier = rfc5280.AlgorithmIdentifier 41 42SubjectPublicKeyInfo = rfc5280.SubjectPublicKeyInfo 43 44 45class Attributes(univ.SetOf): 46 pass 47 48 49Attributes.componentType = Attribute() 50 51 52class CertificationRequestInfo(univ.Sequence): 53 pass 54 55 56CertificationRequestInfo.componentType = namedtype.NamedTypes( 57 namedtype.NamedType('version', univ.Integer()), 58 namedtype.NamedType('subject', Name()), 59 namedtype.NamedType('subjectPKInfo', SubjectPublicKeyInfo()), 60 namedtype.NamedType('attributes', 61 Attributes().subtype(implicitTag=tag.Tag( 62 tag.tagClassContext, tag.tagFormatSimple, 0)) 63 ) 64) 65 66 67class CertificationRequest(univ.Sequence): 68 pass 69 70 71CertificationRequest.componentType = namedtype.NamedTypes( 72 namedtype.NamedType('certificationRequestInfo', CertificationRequestInfo()), 73 namedtype.NamedType('signatureAlgorithm', AlgorithmIdentifier()), 74 namedtype.NamedType('signature', univ.BitString()) 75) 76