Package: src:python-pyasn1-modules Hi Marc,
I uploaded python-pyasn1-modules 0.0.5-0.1 to delayed/5. debdiff is attached, and fixing some packaging issues I found. Matthias
diff -Nru python-pyasn1-modules-0.0.3/CHANGES python-pyasn1-modules-0.0.5/CHANGES --- python-pyasn1-modules-0.0.3/CHANGES 2012-04-11 19:44:45.000000000 +0000 +++ python-pyasn1-modules-0.0.5/CHANGES 2013-03-19 16:56:42.000000000 +0000 @@ -1,3 +1,18 @@ +Revision 0.0.5 +-------------- + +- License updated to vanilla BSD 2-Clause to ease package use + (http://opensource.org/licenses/BSD-2-Clause). + +Revision 0.0.4 +-------------- + +- CMP structures (RFC4210), cmpdump.py tool and test case added. +- SNMPv2c Message syntax (RFC1901) properly defined. +- Package version established in form of __init__.__version__ + which is in-sync with distutils. +- Package meta information and classifiers updated. + Revision 0.0.3 -------------- diff -Nru python-pyasn1-modules-0.0.3/LICENSE python-pyasn1-modules-0.0.5/LICENSE --- python-pyasn1-modules-0.0.3/LICENSE 2012-04-05 18:02:24.000000000 +0000 +++ python-pyasn1-modules-0.0.5/LICENSE 2013-03-19 16:56:42.000000000 +0000 @@ -1,7 +1,5 @@ -Copyright (c) 2011-2012 Ilya Etingof <[email protected]>, all rights reserved. - -THIS SOFTWARE IS NOT FAULT TOLERANT AND SHOULD NOT BE USED IN ANY SITUATION -ENDANGERING HUMAN LIFE OR PROPERTY. +Copyright (c) 2005-2013, Ilya Etingof <[email protected]> +All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -13,16 +11,14 @@ this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * The name of the authors may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff -Nru python-pyasn1-modules-0.0.3/PKG-INFO python-pyasn1-modules-0.0.5/PKG-INFO --- python-pyasn1-modules-0.0.3/PKG-INFO 2012-04-20 08:50:26.000000000 +0000 +++ python-pyasn1-modules-0.0.5/PKG-INFO 2013-05-03 10:11:13.000000000 +0000 @@ -1,21 +1,26 @@ Metadata-Version: 1.0 Name: pyasn1-modules -Version: 0.0.3 -Summary: ASN.1 modules +Version: 0.0.5 +Summary: A collection of ASN.1-based protocols modules. Home-page: http://sourceforge.net/projects/pyasn1/ -Author: Ilya Etingof +Author: Ilya Etingof <[email protected]> Author-email: [email protected] License: BSD -Description: UNKNOWN -Platform: UNKNOWN +Description: A collection of ASN.1 modules expressed in form of pyasn1 classes. Includes protocols PDUs definition (SNMP, LDAP etc.) and various data structures (X.509, PKCS etc.). +Platform: any Classifier: Development Status :: 5 - Production/Stable +Classifier: Environment :: Console Classifier: Intended Audience :: Developers +Classifier: Intended Audience :: Education Classifier: Intended Audience :: Information Technology +Classifier: Intended Audience :: Science/Research +Classifier: Intended Audience :: System Administrators Classifier: Intended Audience :: Telecommunications Industry +Classifier: License :: OSI Approved :: BSD License +Classifier: Natural Language :: English Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 3 Classifier: Topic :: Communications Classifier: Topic :: Security :: Cryptography Classifier: Topic :: Software Development :: Libraries :: Python Modules -Classifier: License :: OSI Approved :: BSD License diff -Nru python-pyasn1-modules-0.0.3/debian/changelog python-pyasn1-modules-0.0.5/debian/changelog --- python-pyasn1-modules-0.0.3/debian/changelog 2014-07-21 11:09:08.000000000 +0000 +++ python-pyasn1-modules-0.0.5/debian/changelog 2014-08-03 18:02:43.000000000 +0000 @@ -1,3 +1,15 @@ +python-pyasn1-modules (0.0.5-0.1) unstable; urgency=medium + + * Non-maintainer upload. + * New upstream release. + * Build depende on python-pyasn1 and python3-pyasn1 to correctly + generate package dependencies. See Debian #756378. + * Bump standards version to 3.9.5. + * Add a watch file. + * Run the testsuite for python and python3. + + -- Matthias Klose <[email protected]> Tue, 29 Jul 2014 11:35:23 +0200 + python-pyasn1-modules (0.0.3-1.1) unstable; urgency=medium * Non-maintainer upload. diff -Nru python-pyasn1-modules-0.0.3/debian/control python-pyasn1-modules-0.0.5/debian/control --- python-pyasn1-modules-0.0.3/debian/control 2014-07-21 11:08:32.000000000 +0000 +++ python-pyasn1-modules-0.0.5/debian/control 2014-08-03 18:09:21.000000000 +0000 @@ -2,7 +2,9 @@ Section: python Priority: optional Maintainer: Marc Haber <[email protected]> -Build-Depends: debhelper (>= 8~), python-all, python3-all, dh-python +Build-Depends: debhelper (>= 8~), dh-python, + python-all, python-pyasn1, + python3-all, python3-pyasn1 Standards-Version: 3.9.5 Homepage: http://pypi.python.org/pypi/pyasn1-modules Vcs-Git: git://git.debian.org/collab-maint/python-pyasn1-modules.git @@ -10,7 +12,7 @@ Package: python-pyasn1-modules Architecture: all -Depends: ${misc:Depends}, ${python:Depends} +Depends: ${misc:Depends}, ${python:Depends}, python-pyasn1 Description: Collection of protocols modules written in ASN.1 language This is a small but growing collection of ASN.1 data structures expressed in Python terms using pyasn1 data model. @@ -22,7 +24,7 @@ Package: python3-pyasn1-modules Architecture: all -Depends: ${misc:Depends}, ${python3:Depends} +Depends: ${misc:Depends}, ${python3:Depends}, python3-pyasn1 Description: Collection of protocols modules written in ASN.1 language (Python 3) This is a small but growing collection of ASN.1 data structures expressed in Python terms using pyasn1 data model. diff -Nru python-pyasn1-modules-0.0.3/debian/copyright python-pyasn1-modules-0.0.5/debian/copyright --- python-pyasn1-modules-0.0.3/debian/copyright 2012-07-28 20:40:15.000000000 +0000 +++ python-pyasn1-modules-0.0.5/debian/copyright 2014-08-03 18:13:08.000000000 +0000 @@ -3,17 +3,8 @@ Source: http://pypi.python.org/pypi/pyasn1-modules Files: * -Copyright: 2011-2012 Ilya Etingof <[email protected]> -License: BSD-3-Clause - -Files: debian/* -Copyright: 2012 Marc Haber <[email protected]> -License: BSD-3-Clause - -License: BSD-3-Clause - THIS SOFTWARE IS NOT FAULT TOLERANT AND SHOULD NOT BE USED IN ANY SITUATION - ENDANGERING HUMAN LIFE OR PROPERTY. - . +Copyright: 2005-2013 Ilya Etingof <[email protected]> +License: BSD-2-Clause Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: . @@ -24,16 +15,18 @@ this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. . - * The name of the authors may not be used to endorse or promote products - derived from this software without specific prior written permission. - . - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +Files: debian/* +Copyright: 2012 Marc Haber <[email protected]> +License: BSD-3-Clause diff -Nru python-pyasn1-modules-0.0.3/debian/patches/python3-test.diff python-pyasn1-modules-0.0.5/debian/patches/python3-test.diff --- python-pyasn1-modules-0.0.3/debian/patches/python3-test.diff 1970-01-01 00:00:00.000000000 +0000 +++ python-pyasn1-modules-0.0.5/debian/patches/python3-test.diff 2014-08-03 18:12:10.000000000 +0000 @@ -0,0 +1,120 @@ +Index: b/test/cmp.sh +=================================================================== +--- a/test/cmp.sh ++++ b/test/cmp.sh +@@ -1,6 +1,6 @@ + #!/bin/sh + +-cmpdump.py <<EOT ++$PYINTERP -m cmpdump <<EOT + MIITuTCCARECAQKkWTBXMQswCQYDVQQGEwJUUjEQMA4GA1UEChMHRS1HdXZlbjEUMBIGA1UECxML + VHJ1c3RDZW50ZXIxIDAeBgNVBAMTF1JTQSBTZWN1cml0eSBDTVAgU2VydmVypC0wKzELMAkGA1UE + BhMCVFIxHDAaBgNVBAMME1ZhbGltby1WZXR0b3ItMTdEZWOgERgPMjAxMjA1MDMxMTE2MTdaoQ8w +Index: b/test/crl.sh +=================================================================== +--- a/test/crl.sh ++++ b/test/crl.sh +@@ -1,6 +1,6 @@ + #!/bin/sh + +-crldump.py <<EOT ++$PYINTERP -m crldump <<EOT + -----BEGIN X509 CRL----- + MIIBVjCBwAIBATANBgkqhkiG9w0BAQUFADB+MQswCQYDVQQGEwJBVTETMBEGA1UE + CBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRk +Index: b/test/crmf.sh +=================================================================== +--- a/test/crmf.sh ++++ b/test/crmf.sh +@@ -1,6 +1,6 @@ + #!/bin/sh + +-crmfdump.py <<EOT ++$PYINTERP -m crmfdump <<EOT + MIIBozCCAZ8wggEFAgUAwTnj2jCByoABAqURMA8xDTALBgNVBAMTBHVzZXKmgZ8w + DQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJ6ZQ2cYbn/lFsmBOlRltbRbFQUvvE0Q + nbopOu1kC7Bmaaz7QTx8nxeiHi4m7uxCbGGxHNoGCt7EmdG8eZUBNAcHyGlXrJdm +Index: b/test/ocspreq.sh +=================================================================== +--- a/test/ocspreq.sh ++++ b/test/ocspreq.sh +@@ -1,6 +1,6 @@ + #!/bin/sh + +-ocspreqdump.py <<EOT ++$PYINTERP -m ocspreqdump <<EOT + MGowaDBBMD8wPTAJBgUrDgMCGgUABBS3ZrMV9C5Dko03aH13cEZeppg3wgQUkqR1LKSevoFE63n8 + isWVpesQdXMCBDXe9M+iIzAhMB8GCSsGAQUFBzABAgQSBBBjdJOiIW9EKJGELNNf/rdA + EOT +Index: b/test/ocsprsp.sh +=================================================================== +--- a/test/ocsprsp.sh ++++ b/test/ocsprsp.sh +@@ -1,6 +1,6 @@ + #!/bin/sh + +-ocsprspdump.py <<EOT ++$PYINTERP -m ocsprspdump <<EOT + MIIEvQoBAKCCBLYwggSyBgkrBgEFBQcwAQEEggSjMIIEnzCCAQ+hgYAwfjELMAkGA1UEBhMCQVUx + EzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEV + MBMGA1UEAxMMc25tcGxhYnMuY29tMSAwHgYJKoZIhvcNAQkBFhFpbmZvQHNubXBsYWJzLmNvbRgP +Index: b/test/pkcs1.sh +=================================================================== +--- a/test/pkcs1.sh ++++ b/test/pkcs1.sh +@@ -1,6 +1,6 @@ + #!/bin/sh + +-pkcs1dump.py <<EOT ++$PYINTERP -m pkcs1dump <<EOT + -----BEGIN DSA PRIVATE KEY----- + MIIBugIBAAKBgQCN91+Cma8UPw09gjwP9WOJCdpv3mv3/qFqzgiODGZx0Q002iTl + 1dq36m5TsWYFEcMCEyC3tFuoQ0mGq5zUUOmJvHCIPufs0g8Av0fhY77uFqneHHUi +Index: b/test/pkcs10.sh +=================================================================== +--- a/test/pkcs10.sh ++++ b/test/pkcs10.sh +@@ -1,6 +1,6 @@ + #!/bin/sh + +-pkcs10dump.py <<EOT ++$PYINTERP -m pkcs10dump <<EOT + -----BEGIN CERTIFICATE REQUEST----- + MIIDATCCAekCAQAwgZkxCzAJBgNVBAYTAlJVMRYwFAYDVQQIEw1Nb3Njb3cgUmVn + aW9uMQ8wDQYDVQQHEwZNb3Njb3cxGjAYBgNVBAoTEVNOTVAgTGFib3JhdG9yaWVz +Index: b/test/pkcs7.sh +=================================================================== +--- a/test/pkcs7.sh ++++ b/test/pkcs7.sh +@@ -1,6 +1,6 @@ + #!/bin/sh + +-pkcs7dump.py <<EOT ++$PYINTERP -m pkcs7dump <<EOT + -----BEGIN PKCS7----- + MIIKdQYJKoZIhvcNAQcCoIIKZjCCCmICAQExADALBgkqhkiG9w0BBwGgggpIMIIC + XjCCAcegAwIBAgIBADANBgkqhkiG9w0BAQQFADB1MQswCQYDVQQGEwJSVTEPMA0G +Index: b/test/pkcs8.sh +=================================================================== +--- a/test/pkcs8.sh ++++ b/test/pkcs8.sh +@@ -1,6 +1,6 @@ + #!/bin/sh + +-pkcs8dump.py <<EOT ++$PYINTERP -m pkcs8dump <<EOT + -----BEGIN ENCRYPTED PRIVATE KEY----- + MIIBgTAbBgkqhkiG9w0BBQMwDgQIdtFgDWnipT8CAggABIIBYN0hkm2xqkTCt8dJ + iZS8+HNiyHxy8g+rmWSXv/i+bTHFUReZA2GINtTRUkWpXqWcSHxNslgf7QdfgbVJ +Index: b/test/x509dump.sh +=================================================================== +--- a/test/x509dump.sh ++++ b/test/x509dump.sh +@@ -1,6 +1,6 @@ + #!/bin/sh + +-x509dump.py <<EOT ++$PYINTERP -m x509dump <<EOT + -----BEGIN CERTIFICATE----- + MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0 + IFZhbGlkYXRpb24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAz diff -Nru python-pyasn1-modules-0.0.3/debian/patches/series python-pyasn1-modules-0.0.5/debian/patches/series --- python-pyasn1-modules-0.0.3/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ python-pyasn1-modules-0.0.5/debian/patches/series 2014-08-03 18:12:10.000000000 +0000 @@ -0,0 +1 @@ +python3-test.diff diff -Nru python-pyasn1-modules-0.0.3/debian/rules python-pyasn1-modules-0.0.5/debian/rules --- python-pyasn1-modules-0.0.3/debian/rules 2014-07-15 10:27:23.000000000 +0000 +++ python-pyasn1-modules-0.0.5/debian/rules 2014-08-03 18:12:10.000000000 +0000 @@ -11,3 +11,11 @@ %: dh $@ --with python2,python3 --buildsystem=pybuild + +override_dh_auto_test: + set -ex; \ + export PYINTERP=python; \ + for script in test/*.sh; do PYTHONPATH=.:./tools PATH=./tools:$$PATH sh -x $$script; done + set -ex; \ + export PYINTERP=python3; \ + for script in test/*.sh; do PYTHONPATH=.:./tools PATH=./tools:$$PATH sh -x $$script; done diff -Nru python-pyasn1-modules-0.0.3/debian/watch python-pyasn1-modules-0.0.5/debian/watch --- python-pyasn1-modules-0.0.3/debian/watch 1970-01-01 00:00:00.000000000 +0000 +++ python-pyasn1-modules-0.0.5/debian/watch 2014-07-15 10:34:47.000000000 +0000 @@ -0,0 +1,3 @@ +version=3 +opts=uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha|b|a)[\-\.]?\d*)$/$1~$2/ \ +http://pypi.python.org/packages/source/p/pyasn1-modules/pyasn1-modules-(\d.*)\.(?:tgz|tar\.(?:gz|bz2|xz)) diff -Nru python-pyasn1-modules-0.0.3/pyasn1_modules/__init__.py python-pyasn1-modules-0.0.5/pyasn1_modules/__init__.py --- python-pyasn1-modules-0.0.3/pyasn1_modules/__init__.py 2011-02-17 18:35:16.000000000 +0000 +++ python-pyasn1-modules-0.0.5/pyasn1_modules/__init__.py 2013-01-05 08:03:35.000000000 +0000 @@ -0,0 +1,2 @@ +# http://www.python.org/dev/peps/pep-0396/ +__version__ = '0.0.5' diff -Nru python-pyasn1-modules-0.0.3/pyasn1_modules/rfc1901.py python-pyasn1-modules-0.0.5/pyasn1_modules/rfc1901.py --- python-pyasn1-modules-0.0.3/pyasn1_modules/rfc1901.py 1970-01-01 00:00:00.000000000 +0000 +++ python-pyasn1-modules-0.0.5/pyasn1_modules/rfc1901.py 2012-07-11 15:36:25.000000000 +0000 @@ -0,0 +1,15 @@ +# +# SNMPv2c message syntax +# +# ASN.1 source from: +# http://www.ietf.org/rfc/rfc1901.txt +# +from pyasn1.type import univ, namedtype, namedval + +class Message(univ.Sequence): + componentType = namedtype.NamedTypes( + namedtype.NamedType('version', univ.Integer(namedValues = namedval.NamedValues(('version-2c', 1)))), + namedtype.NamedType('community', univ.OctetString()), + namedtype.NamedType('data', univ.Any()) + ) + diff -Nru python-pyasn1-modules-0.0.3/pyasn1_modules/rfc1905.py python-pyasn1-modules-0.0.5/pyasn1_modules/rfc1905.py --- python-pyasn1-modules-0.0.3/pyasn1_modules/rfc1905.py 2012-04-11 16:53:20.000000000 +0000 +++ python-pyasn1-modules-0.0.5/pyasn1_modules/rfc1905.py 2012-07-11 15:35:02.000000000 +0000 @@ -1,5 +1,5 @@ # -# SNMPv2c message syntax +# SNMPv2c PDU syntax # # ASN.1 source from: # http://www.ietf.org/rfc/rfc1905.txt diff -Nru python-pyasn1-modules-0.0.3/pyasn1_modules/rfc4210.py python-pyasn1-modules-0.0.5/pyasn1_modules/rfc4210.py --- python-pyasn1-modules-0.0.3/pyasn1_modules/rfc4210.py 1970-01-01 00:00:00.000000000 +0000 +++ python-pyasn1-modules-0.0.5/pyasn1_modules/rfc4210.py 2012-05-30 15:26:27.000000000 +0000 @@ -0,0 +1,695 @@ +# +# Certificate Management Protocol structures as per RFC4210 +# +# Based on Alex Railean's work +# +from pyasn1.type import tag,namedtype,namedval,univ,constraint,char,useful +from pyasn1_modules import rfc2459, rfc2511, rfc2314 + +MAX = 64 + +class KeyIdentifier(univ.OctetString): pass + +class CMPCertificate(rfc2459.Certificate): pass + +class OOBCert(CMPCertificate): pass + +class CertAnnContent(CMPCertificate): pass + +class PKIFreeText(univ.SequenceOf): + """ + PKIFreeText ::= SEQUENCE SIZE (1..MAX) OF UTF8String + """ + componentType = char.UTF8String() + subtypeSpec = univ.SequenceOf.subtypeSpec + constraint.ValueSizeConstraint(1, MAX) + +class PollRepContent(univ.SequenceOf): + """ + PollRepContent ::= SEQUENCE OF SEQUENCE { + certReqId INTEGER, + checkAfter INTEGER, -- time in seconds + reason PKIFreeText OPTIONAL + } + """ + class CertReq(univ.Sequence): + componentType = namedtype.NamedTypes( + namedtype.NamedType('certReqId', univ.Integer()), + namedtype.NamedType('checkAfter', univ.Integer()), + namedtype.OptionalNamedType('reason', PKIFreeText()) + ) + componentType = CertReq() + +class PollReqContent(univ.SequenceOf): + """ + PollReqContent ::= SEQUENCE OF SEQUENCE { + certReqId INTEGER + } + + """ + class CertReq(univ.Sequence): + componentType = namedtype.NamedTypes( + namedtype.NamedType('certReqId', univ.Integer()) + ) + componentType = CertReq() + +class InfoTypeAndValue(univ.Sequence): + """ + InfoTypeAndValue ::= SEQUENCE { + infoType OBJECT IDENTIFIER, + infoValue ANY DEFINED BY infoType OPTIONAL + }""" + componentType = namedtype.NamedTypes( + namedtype.NamedType('infoType', univ.ObjectIdentifier()), + namedtype.OptionalNamedType('infoValue', univ.Any()) + ) + +class GenRepContent(univ.SequenceOf): + componentType = InfoTypeAndValue() + +class GenMsgContent(univ.SequenceOf): + componentType = InfoTypeAndValue() + +class PKIConfirmContent(univ.Null): pass + +class CRLAnnContent(univ.SequenceOf): + componentType = rfc2459.CertificateList() + +class CAKeyUpdAnnContent(univ.Sequence): + """ + CAKeyUpdAnnContent ::= SEQUENCE { + oldWithNew CMPCertificate, + newWithOld CMPCertificate, + newWithNew CMPCertificate + } + """ + componentType = namedtype.NamedTypes( + namedtype.NamedType('oldWithNew', CMPCertificate()), + namedtype.NamedType('newWithOld', CMPCertificate()), + namedtype.NamedType('newWithNew', CMPCertificate()) + ) + +class RevDetails(univ.Sequence): + """ + RevDetails ::= SEQUENCE { + certDetails CertTemplate, + crlEntryDetails Extensions OPTIONAL + } + """ + componentType = namedtype.NamedTypes( + namedtype.NamedType('certDetails', rfc2511.CertTemplate()), + namedtype.OptionalNamedType('crlEntryDetails', rfc2459.Extensions()) + ) + +class RevReqContent(univ.SequenceOf): + componentType = RevDetails() + +class CertOrEncCert(univ.Choice): + """ + CertOrEncCert ::= CHOICE { + certificate [0] CMPCertificate, + encryptedCert [1] EncryptedValue + } + """ + componentType = namedtype.NamedTypes( + namedtype.NamedType('certificate', CMPCertificate().subtype( + explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0) + ) + ), + namedtype.NamedType('encryptedCert', rfc2511.EncryptedValue().subtype( + explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1) + ) + ) + ) + +class CertifiedKeyPair(univ.Sequence): + """ + CertifiedKeyPair ::= SEQUENCE { + certOrEncCert CertOrEncCert, + privateKey [0] EncryptedValue OPTIONAL, + publicationInfo [1] PKIPublicationInfo OPTIONAL + } + """ + componentType = namedtype.NamedTypes( + namedtype.NamedType('certOrEncCert', CertOrEncCert()), + namedtype.OptionalNamedType('privateKey', rfc2511.EncryptedValue().subtype( + explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0) + ) + ), + namedtype.OptionalNamedType('publicationInfo', rfc2511.PKIPublicationInfo().subtype( + explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1) + ) + ) + ) + + +class POPODecKeyRespContent(univ.SequenceOf): + componentType = univ.Integer() + +class Challenge(univ.Sequence): + """ + Challenge ::= SEQUENCE { + owf AlgorithmIdentifier OPTIONAL, + witness OCTET STRING, + challenge OCTET STRING + } + """ + componentType = namedtype.NamedTypes( + namedtype.OptionalNamedType('owf', rfc2459.AlgorithmIdentifier()), + namedtype.NamedType('witness', univ.OctetString()), + namedtype.NamedType('challenge', univ.OctetString()) + ) + +class PKIStatus(univ.Integer): + """ + PKIStatus ::= INTEGER { + accepted (0), + grantedWithMods (1), + rejection (2), + waiting (3), + revocationWarning (4), + revocationNotification (5), + keyUpdateWarning (6) + } + """ + namedValues = namedval.NamedValues( + ('accepted', 0), + ('grantedWithMods', 1), + ('rejection', 2), + ('waiting', 3), + ('revocationWarning', 4), + ('revocationNotification', 5), + ('keyUpdateWarning', 6) + ) + +class PKIFailureInfo(univ.BitString): + """ + PKIFailureInfo ::= BIT STRING { + badAlg (0), + badMessageCheck (1), + badRequest (2), + badTime (3), + badCertId (4), + badDataFormat (5), + wrongAuthority (6), + incorrectData (7), + missingTimeStamp (8), + badPOP (9), + certRevoked (10), + certConfirmed (11), + wrongIntegrity (12), + badRecipientNonce (13), + timeNotAvailable (14), + unacceptedPolicy (15), + unacceptedExtension (16), + addInfoNotAvailable (17), + badSenderNonce (18), + badCertTemplate (19), + signerNotTrusted (20), + transactionIdInUse (21), + unsupportedVersion (22), + notAuthorized (23), + systemUnavail (24), + systemFailure (25), + duplicateCertReq (26) + """ + namedValues = namedval.NamedValues( + ('badAlg', 0), + ('badMessageCheck', 1), + ('badRequest', 2), + ('badTime', 3), + ('badCertId', 4), + ('badDataFormat', 5), + ('wrongAuthority', 6), + ('incorrectData', 7), + ('missingTimeStamp', 8), + ('badPOP', 9), + ('certRevoked', 10), + ('certConfirmed', 11), + ('wrongIntegrity', 12), + ('badRecipientNonce', 13), + ('timeNotAvailable', 14), + ('unacceptedPolicy', 15), + ('unacceptedExtension', 16), + ('addInfoNotAvailable', 17), + ('badSenderNonce', 18), + ('badCertTemplate', 19), + ('signerNotTrusted', 20), + ('transactionIdInUse', 21), + ('unsupportedVersion', 22), + ('notAuthorized', 23), + ('systemUnavail', 24), + ('systemFailure', 25), + ('duplicateCertReq', 26) + ) + +class PKIStatusInfo(univ.Sequence): + """ + PKIStatusInfo ::= SEQUENCE { + status PKIStatus, + statusString PKIFreeText OPTIONAL, + failInfo PKIFailureInfo OPTIONAL + } + """ + componentType = namedtype.NamedTypes( + namedtype.NamedType('status', PKIStatus()), + namedtype.OptionalNamedType('statusString', PKIFreeText()), + namedtype.OptionalNamedType('failInfo', PKIFailureInfo()) + ) + +class ErrorMsgContent(univ.Sequence): + """ + ErrorMsgContent ::= SEQUENCE { + pKIStatusInfo PKIStatusInfo, + errorCode INTEGER OPTIONAL, + -- implementation-specific error codes + errorDetails PKIFreeText OPTIONAL + -- implementation-specific error details + } + """ + componentType = namedtype.NamedTypes( + namedtype.NamedType('pKIStatusInfo', PKIStatusInfo()), + namedtype.OptionalNamedType('errorCode', univ.Integer()), + namedtype.OptionalNamedType('errorDetails', PKIFreeText()) + ) + +class CertStatus(univ.Sequence): + """ + CertStatus ::= SEQUENCE { + certHash OCTET STRING, + certReqId INTEGER, + statusInfo PKIStatusInfo OPTIONAL + } + """ + componentType = namedtype.NamedTypes( + namedtype.NamedType('certHash', univ.OctetString()), + namedtype.NamedType('certReqId', univ.Integer()), + namedtype.OptionalNamedType('statusInfo', PKIStatusInfo()) + ) + +class CertConfirmContent(univ.SequenceOf): + componentType = CertStatus() + +class RevAnnContent(univ.Sequence): + """ + RevAnnContent ::= SEQUENCE { + status PKIStatus, + certId CertId, + willBeRevokedAt GeneralizedTime, + badSinceDate GeneralizedTime, + crlDetails Extensions OPTIONAL + } + """ + componentType = namedtype.NamedTypes( + namedtype.NamedType('status', PKIStatus()), + namedtype.NamedType('certId', rfc2511.CertId()), + namedtype.NamedType('willBeRevokedAt', useful.GeneralizedTime()), + namedtype.NamedType('badSinceDate', useful.GeneralizedTime()), + namedtype.OptionalNamedType('crlDetails', rfc2459.Extensions()) + ) + +class RevRepContent(univ.Sequence): + """ + RevRepContent ::= SEQUENCE { + status SEQUENCE SIZE (1..MAX) OF PKIStatusInfo, + revCerts [0] SEQUENCE SIZE (1..MAX) OF CertId + OPTIONAL, + crls [1] SEQUENCE SIZE (1..MAX) OF CertificateList + OPTIONAL + """ + componentType = namedtype.NamedTypes( + namedtype.NamedType('status', PKIStatusInfo()), + namedtype.OptionalNamedType('revCerts', univ.SequenceOf( + componentType=rfc2511.CertId() + ).subtype( + subtypeSpec=constraint.ValueSizeConstraint(1, MAX), + explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0) + ) + ), + namedtype.OptionalNamedType('crls', univ.SequenceOf( + componentType=rfc2459.CertificateList() + ).subtype( + subtypeSpec=constraint.ValueSizeConstraint(1, MAX), + explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1) + ) + ) + ) + +class KeyRecRepContent(univ.Sequence): + """ + KeyRecRepContent ::= SEQUENCE { + status PKIStatusInfo, + newSigCert [0] CMPCertificate OPTIONAL, + caCerts [1] SEQUENCE SIZE (1..MAX) OF + CMPCertificate OPTIONAL, + keyPairHist [2] SEQUENCE SIZE (1..MAX) OF + CertifiedKeyPair OPTIONAL + } + """ + componentType = namedtype.NamedTypes( + namedtype.NamedType('status', PKIStatusInfo()), + namedtype.OptionalNamedType('newSigCert', CMPCertificate().subtype( + explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0) + ) + ), + namedtype.OptionalNamedType('caCerts', univ.SequenceOf( + componentType=CMPCertificate() + ).subtype( + explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1), + subtypeSpec=constraint.ValueSizeConstraint(1, MAX) + ) + ), + namedtype.OptionalNamedType('keyPairHist', univ.SequenceOf( + componentType=CertifiedKeyPair() + ).subtype( + explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2), + subtypeSpec=constraint.ValueSizeConstraint(1, MAX) + ) + ) + ) + +class CertResponse(univ.Sequence): + """ + CertResponse ::= SEQUENCE { + certReqId INTEGER, + status PKIStatusInfo, + certifiedKeyPair CertifiedKeyPair OPTIONAL, + rspInfo OCTET STRING OPTIONAL + } + """ + componentType = namedtype.NamedTypes( + namedtype.NamedType('certReqId', univ.Integer()), + namedtype.NamedType('status', PKIStatusInfo()), + namedtype.OptionalNamedType('certifiedKeyPair', CertifiedKeyPair()), + namedtype.OptionalNamedType('rspInfo', univ.OctetString()) + ) + +class CertRepMessage(univ.Sequence): + """ + CertRepMessage ::= SEQUENCE { + caPubs [1] SEQUENCE SIZE (1..MAX) OF CMPCertificate + OPTIONAL, + response SEQUENCE OF CertResponse + } + """ + componentType = namedtype.NamedTypes( + namedtype.OptionalNamedType('caPubs', univ.SequenceOf( + componentType=CMPCertificate() + ).subtype( + subtypeSpec=constraint.ValueSizeConstraint(1, MAX), + explicitTag=tag.Tag(tag.tagClassContext,tag.tagFormatConstructed,1) + ) + ), + namedtype.NamedType('response', univ.SequenceOf( + componentType=CertResponse()) + ) + ) + +class POPODecKeyChallContent(univ.SequenceOf): + componentType = Challenge() + +class OOBCertHash(univ.Sequence): + """ + OOBCertHash ::= SEQUENCE { + hashAlg [0] AlgorithmIdentifier OPTIONAL, + certId [1] CertId OPTIONAL, + hashVal BIT STRING + } + """ + componentType = namedtype.NamedTypes( + namedtype.OptionalNamedType('hashAlg', + rfc2459.AlgorithmIdentifier().subtype( + explicitTag=tag.Tag(tag.tagClassContext,tag.tagFormatConstructed,0) + ) + ), + namedtype.OptionalNamedType('certId', rfc2511.CertId().subtype( + explicitTag=tag.Tag(tag.tagClassContext,tag.tagFormatConstructed,1) + ) + ), + namedtype.NamedType('hashVal', univ.BitString()) + ) + +# pyasn1 does not naturally handle recursive definitions, thus this hack: +# NestedMessageContent ::= PKIMessages +class NestedMessageContent(univ.SequenceOf): + """ + NestedMessageContent ::= PKIMessages + """ + componentType = univ.Any() + +class DHBMParameter(univ.Sequence): + """ + DHBMParameter ::= SEQUENCE { + owf AlgorithmIdentifier, + -- AlgId for a One-Way Function (SHA-1 recommended) + mac AlgorithmIdentifier + -- the MAC AlgId (e.g., DES-MAC, Triple-DES-MAC [PKCS11], + } -- or HMAC [RFC2104, RFC2202]) + """ + componentType = namedtype.NamedTypes( + namedtype.NamedType('owf', rfc2459.AlgorithmIdentifier()), + namedtype.NamedType('mac', rfc2459.AlgorithmIdentifier()) + ) + +id_DHBasedMac = univ.ObjectIdentifier('1.2.840.113533.7.66.30') + +class PBMParameter(univ.Sequence): + """ + PBMParameter ::= SEQUENCE { + salt OCTET STRING, + owf AlgorithmIdentifier, + iterationCount INTEGER, + mac AlgorithmIdentifier + } + """ + componentType = namedtype.NamedTypes( + namedtype.NamedType('salt', univ.OctetString().subtype( + subtypeSpec=constraint.ValueSizeConstraint(0, 128) + ) + ), + namedtype.NamedType('owf', rfc2459.AlgorithmIdentifier()), + namedtype.NamedType('iterationCount', univ.Integer()), + namedtype.NamedType('mac', rfc2459.AlgorithmIdentifier()) + ) + +id_PasswordBasedMac = univ.ObjectIdentifier('1.2.840.113533.7.66.13') + +class PKIProtection(univ.BitString): pass + +# pyasn1 does not naturally handle recursive definitions, thus this hack: +# NestedMessageContent ::= PKIMessages +nestedMessageContent = NestedMessageContent().subtype(explicitTag=tag.Tag(tag.tagClassContext,tag.tagFormatConstructed,20)) + +class PKIBody(univ.Choice): + """ + PKIBody ::= CHOICE { -- message-specific body elements + ir [0] CertReqMessages, --Initialization Request + ip [1] CertRepMessage, --Initialization Response + cr [2] CertReqMessages, --Certification Request + cp [3] CertRepMessage, --Certification Response + p10cr [4] CertificationRequest, --imported from [PKCS10] + popdecc [5] POPODecKeyChallContent, --pop Challenge + popdecr [6] POPODecKeyRespContent, --pop Response + kur [7] CertReqMessages, --Key Update Request + kup [8] CertRepMessage, --Key Update Response + krr [9] CertReqMessages, --Key Recovery Request + krp [10] KeyRecRepContent, --Key Recovery Response + rr [11] RevReqContent, --Revocation Request + rp [12] RevRepContent, --Revocation Response + ccr [13] CertReqMessages, --Cross-Cert. Request + ccp [14] CertRepMessage, --Cross-Cert. Response + ckuann [15] CAKeyUpdAnnContent, --CA Key Update Ann. + cann [16] CertAnnContent, --Certificate Ann. + rann [17] RevAnnContent, --Revocation Ann. + crlann [18] CRLAnnContent, --CRL Announcement + pkiconf [19] PKIConfirmContent, --Confirmation + nested [20] NestedMessageContent, --Nested Message + genm [21] GenMsgContent, --General Message + + """ + componentType = namedtype.NamedTypes( + namedtype.NamedType('ir', rfc2511.CertReqMessages().subtype( + explicitTag=tag.Tag(tag.tagClassContext,tag.tagFormatConstructed,0) + ) + ), + namedtype.NamedType('ip', CertRepMessage().subtype( + explicitTag=tag.Tag(tag.tagClassContext,tag.tagFormatConstructed,1) + ) + ), + namedtype.NamedType('cr', rfc2511.CertReqMessages().subtype( + explicitTag=tag.Tag(tag.tagClassContext,tag.tagFormatConstructed,2) + ) + ), + namedtype.NamedType('cp', CertRepMessage().subtype( + explicitTag=tag.Tag(tag.tagClassContext,tag.tagFormatConstructed,3) + ) + ), + namedtype.NamedType('p10cr', rfc2314.CertificationRequest().subtype( + explicitTag=tag.Tag(tag.tagClassContext,tag.tagFormatConstructed,4) + ) + ), + namedtype.NamedType('popdecc', POPODecKeyChallContent().subtype( + explicitTag=tag.Tag(tag.tagClassContext,tag.tagFormatConstructed,5) + ) + ), + namedtype.NamedType('popdecr', POPODecKeyRespContent().subtype( + explicitTag=tag.Tag(tag.tagClassContext,tag.tagFormatConstructed,6) + ) + ), + namedtype.NamedType('kur', rfc2511.CertReqMessages().subtype( + explicitTag=tag.Tag(tag.tagClassContext,tag.tagFormatConstructed,7) + ) + ), + namedtype.NamedType('kup', CertRepMessage().subtype( + explicitTag=tag.Tag(tag.tagClassContext,tag.tagFormatConstructed,8) + ) + ), + namedtype.NamedType('krr', rfc2511.CertReqMessages().subtype( + explicitTag=tag.Tag(tag.tagClassContext,tag.tagFormatConstructed,9) + ) + ), + namedtype.NamedType('krp', KeyRecRepContent().subtype( + explicitTag=tag.Tag(tag.tagClassContext,tag.tagFormatConstructed,10) + ) + ), + namedtype.NamedType('rr', RevReqContent().subtype( + explicitTag=tag.Tag(tag.tagClassContext,tag.tagFormatConstructed,11) + ) + ), + namedtype.NamedType('rp', RevRepContent().subtype( + explicitTag=tag.Tag(tag.tagClassContext,tag.tagFormatConstructed,12) + ) + ), + namedtype.NamedType('ccr', rfc2511.CertReqMessages().subtype( + explicitTag=tag.Tag(tag.tagClassContext,tag.tagFormatConstructed,13) + ) + ), + namedtype.NamedType('ccp', CertRepMessage().subtype( + explicitTag=tag.Tag(tag.tagClassContext,tag.tagFormatConstructed,14) + ) + ), + namedtype.NamedType('ckuann', CAKeyUpdAnnContent().subtype( + explicitTag=tag.Tag(tag.tagClassContext,tag.tagFormatConstructed,15) + ) + ), + namedtype.NamedType('cann', CertAnnContent().subtype( + explicitTag=tag.Tag(tag.tagClassContext,tag.tagFormatConstructed,16) + ) + ), + namedtype.NamedType('rann', RevAnnContent().subtype( + explicitTag=tag.Tag(tag.tagClassContext,tag.tagFormatConstructed,17) + ) + ), + namedtype.NamedType('crlann', CRLAnnContent().subtype( + explicitTag=tag.Tag(tag.tagClassContext,tag.tagFormatConstructed,18) + ) + ), + namedtype.NamedType('pkiconf', PKIConfirmContent().subtype( + explicitTag=tag.Tag(tag.tagClassContext,tag.tagFormatConstructed,19) + ) + ), + namedtype.NamedType('nested', nestedMessageContent), +# namedtype.NamedType('nested', NestedMessageContent().subtype( +# explicitTag=tag.Tag(tag.tagClassContext,tag.tagFormatConstructed,20) +# ) +# ), + namedtype.NamedType('genm', GenMsgContent().subtype( + explicitTag=tag.Tag(tag.tagClassContext,tag.tagFormatConstructed,21) + ) + ) + ) + + +class PKIHeader(univ.Sequence): + """ + PKIHeader ::= SEQUENCE { + pvno INTEGER { cmp1999(1), cmp2000(2) }, + sender GeneralName, + recipient GeneralName, + messageTime [0] GeneralizedTime OPTIONAL, + protectionAlg [1] AlgorithmIdentifier OPTIONAL, + senderKID [2] KeyIdentifier OPTIONAL, + recipKID [3] KeyIdentifier OPTIONAL, + transactionID [4] OCTET STRING OPTIONAL, + senderNonce [5] OCTET STRING OPTIONAL, + recipNonce [6] OCTET STRING OPTIONAL, + freeText [7] PKIFreeText OPTIONAL, + generalInfo [8] SEQUENCE SIZE (1..MAX) OF + InfoTypeAndValue OPTIONAL + } + + """ + componentType = namedtype.NamedTypes( + namedtype.NamedType('pvno', univ.Integer( + namedValues=namedval.NamedValues( + ('cmp1999', 1), + ('cmp2000', 2) + ) + ) + ), + namedtype.NamedType('sender', rfc2459.GeneralName()), + namedtype.NamedType('recipient', rfc2459.GeneralName()), + namedtype.OptionalNamedType('messageTime', useful.GeneralizedTime().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))), + namedtype.OptionalNamedType('protectionAlg', rfc2459.AlgorithmIdentifier().subtype( + explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))), + namedtype.OptionalNamedType('senderKID', rfc2459.KeyIdentifier().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))), + namedtype.OptionalNamedType('recipKID', rfc2459.KeyIdentifier().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))), + namedtype.OptionalNamedType('transactionID', univ.OctetString().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4))), + namedtype.OptionalNamedType('senderNonce', univ.OctetString().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 5))), + namedtype.OptionalNamedType('recipNonce', univ.OctetString().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 6))), + namedtype.OptionalNamedType('freeText', PKIFreeText().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 7))), + namedtype.OptionalNamedType('generalInfo', + univ.SequenceOf( + componentType=InfoTypeAndValue().subtype( + subtypeSpec=constraint.ValueSizeConstraint(1, MAX), + explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 8) + ) + ) + ) + ) + +class ProtectedPart(univ.Sequence): + """ + ProtectedPart ::= SEQUENCE { + header PKIHeader, + body PKIBody + } + """ + componentType = namedtype.NamedTypes( + namedtype.NamedType('header', PKIHeader()), + namedtype.NamedType('infoValue', PKIBody()) + ) + +class PKIMessage(univ.Sequence): + """ + PKIMessage ::= SEQUENCE { + header PKIHeader, + body PKIBody, + protection [0] PKIProtection OPTIONAL, + extraCerts [1] SEQUENCE SIZE (1..MAX) OF CMPCertificate + OPTIONAL + }""" + componentType = namedtype.NamedTypes( + namedtype.NamedType('header', PKIHeader()), + namedtype.NamedType('body', PKIBody()), + namedtype.OptionalNamedType('protection', PKIProtection().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))), + namedtype.OptionalNamedType( 'extraCerts', + univ.SequenceOf( + componentType=CMPCertificate() + ).subtype( + subtypeSpec=constraint.ValueSizeConstraint(1, MAX), + explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1) + ) + ) + ) + +class PKIMessages(univ.SequenceOf): + """ + PKIMessages ::= SEQUENCE SIZE (1..MAX) OF PKIMessage + """ + componentType = PKIMessage() + subtypeSpec = univ.SequenceOf.subtypeSpec + constraint.ValueSizeConstraint(1, MAX) + +# pyasn1 does not naturally handle recursive definitions, thus this hack: +# NestedMessageContent ::= PKIMessages +NestedMessageContent.componentType = PKIMessages() +nestedMessageContent.componentType = PKIMessages() diff -Nru python-pyasn1-modules-0.0.3/pyasn1_modules.egg-info/PKG-INFO python-pyasn1-modules-0.0.5/pyasn1_modules.egg-info/PKG-INFO --- python-pyasn1-modules-0.0.3/pyasn1_modules.egg-info/PKG-INFO 2012-04-20 08:50:25.000000000 +0000 +++ python-pyasn1-modules-0.0.5/pyasn1_modules.egg-info/PKG-INFO 2013-05-03 10:11:13.000000000 +0000 @@ -1,21 +1,26 @@ Metadata-Version: 1.0 Name: pyasn1-modules -Version: 0.0.3 -Summary: ASN.1 modules +Version: 0.0.5 +Summary: A collection of ASN.1-based protocols modules. Home-page: http://sourceforge.net/projects/pyasn1/ -Author: Ilya Etingof +Author: Ilya Etingof <[email protected]> Author-email: [email protected] License: BSD -Description: UNKNOWN -Platform: UNKNOWN +Description: A collection of ASN.1 modules expressed in form of pyasn1 classes. Includes protocols PDUs definition (SNMP, LDAP etc.) and various data structures (X.509, PKCS etc.). +Platform: any Classifier: Development Status :: 5 - Production/Stable +Classifier: Environment :: Console Classifier: Intended Audience :: Developers +Classifier: Intended Audience :: Education Classifier: Intended Audience :: Information Technology +Classifier: Intended Audience :: Science/Research +Classifier: Intended Audience :: System Administrators Classifier: Intended Audience :: Telecommunications Industry +Classifier: License :: OSI Approved :: BSD License +Classifier: Natural Language :: English Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 3 Classifier: Topic :: Communications Classifier: Topic :: Security :: Cryptography Classifier: Topic :: Software Development :: Libraries :: Python Modules -Classifier: License :: OSI Approved :: BSD License diff -Nru python-pyasn1-modules-0.0.3/pyasn1_modules.egg-info/SOURCES.txt python-pyasn1-modules-0.0.5/pyasn1_modules.egg-info/SOURCES.txt --- python-pyasn1-modules-0.0.3/pyasn1_modules.egg-info/SOURCES.txt 2012-04-20 08:50:25.000000000 +0000 +++ python-pyasn1-modules-0.0.5/pyasn1_modules.egg-info/SOURCES.txt 2013-05-03 10:11:13.000000000 +0000 @@ -8,6 +8,7 @@ pyasn1_modules/pkcs12.py pyasn1_modules/rfc1155.py pyasn1_modules/rfc1157.py +pyasn1_modules/rfc1901.py pyasn1_modules/rfc1902.py pyasn1_modules/rfc1905.py pyasn1_modules/rfc2251.py @@ -20,6 +21,7 @@ pyasn1_modules/rfc3412.py pyasn1_modules/rfc3414.py pyasn1_modules/rfc3447.py +pyasn1_modules/rfc4210.py pyasn1_modules/rfc5208.py pyasn1_modules.egg-info/PKG-INFO pyasn1_modules.egg-info/SOURCES.txt @@ -27,6 +29,7 @@ pyasn1_modules.egg-info/requires.txt pyasn1_modules.egg-info/top_level.txt pyasn1_modules.egg-info/zip-safe +test/cmp.sh test/crl.sh test/crmf.sh test/ocspreq.sh @@ -36,11 +39,13 @@ test/pkcs7.sh test/pkcs8.sh test/x509dump.sh +tools/cmpdump.py tools/crldump.py tools/crmfdump.py tools/ocspclient.py tools/ocspreqdump.py tools/ocsprspdump.py +tools/ocspserver.py tools/pkcs10dump.py tools/pkcs1dump.py tools/pkcs7dump.py diff -Nru python-pyasn1-modules-0.0.3/pyasn1_modules.egg-info/requires.txt python-pyasn1-modules-0.0.5/pyasn1_modules.egg-info/requires.txt --- python-pyasn1-modules-0.0.3/pyasn1_modules.egg-info/requires.txt 2012-04-20 08:50:25.000000000 +0000 +++ python-pyasn1-modules-0.0.5/pyasn1_modules.egg-info/requires.txt 2013-05-03 10:11:13.000000000 +0000 @@ -1 +1 @@ -pyasn1>=0.1.1 \ No newline at end of file +pyasn1>=0.1.4 \ No newline at end of file diff -Nru python-pyasn1-modules-0.0.3/setup.py python-pyasn1-modules-0.0.5/setup.py --- python-pyasn1-modules-0.0.3/setup.py 2012-04-17 19:41:05.000000000 +0000 +++ python-pyasn1-modules-0.0.5/setup.py 2012-07-23 16:49:00.000000000 +0000 @@ -1,51 +1,87 @@ #!/usr/bin/env python -import sys +"""A collection of ASN.1-based protocols modules. + + A collection of ASN.1 modules expressed in form of pyasn1 classes. + Includes protocols PDUs definition (SNMP, LDAP etc.) and various + data structures (X.509, PKCS etc.). +""" + +classifiers = """\ +Development Status :: 5 - Production/Stable +Environment :: Console +Intended Audience :: Developers +Intended Audience :: Education +Intended Audience :: Information Technology +Intended Audience :: Science/Research +Intended Audience :: System Administrators +Intended Audience :: Telecommunications Industry +License :: OSI Approved :: BSD License +Natural Language :: English +Operating System :: OS Independent +Programming Language :: Python :: 2 +Programming Language :: Python :: 3 +Topic :: Communications +Topic :: Security :: Cryptography +Topic :: Software Development :: Libraries :: Python Modules +""" + +def howto_install_distribute(): + print(""" + Error: You need the distribute Python package! + + It's very easy to install it, just type (as root on Linux): + + wget http://python-distribute.org/distribute_setup.py + python distribute_setup.py + + Then you could make eggs from this package. +""") def howto_install_setuptools(): print(""" Error: You need setuptools Python package! It's very easy to install it, just type (as root on Linux): + wget http://peak.telecommunity.com/dist/ez_setup.py python ez_setup.py + + Then you could make eggs from this package. """) try: from setuptools import setup params = { - 'install_requires': [ 'pyasn1>=0.1.1' ], + 'install_requires': [ 'pyasn1>=0.1.4' ], 'zip_safe': True } except ImportError: + import sys for arg in sys.argv: if arg.find('egg') != -1: - howto_install_setuptools() + if sys.version_info[0] > 2: + howto_install_distribute() + else: + howto_install_setuptools() sys.exit(1) from distutils.core import setup params = {} if sys.version_info[:2] > (2, 4): - params['requires'] = [ 'pyasn1(>=0.1.1)' ] + params['requires'] = [ 'pyasn1(>=0.1.4)' ] + +doclines = [ x.strip() for x in __doc__.split('\n') if x ] params.update( { 'name': 'pyasn1-modules', - 'version': '0.0.3', - 'description': 'ASN.1 modules', + 'version': open('pyasn1_modules/__init__.py').read().split('\'')[1], + 'description': doclines[0], + 'long_description': ' '.join(doclines[1:]), + 'maintainer': 'Ilya Etingof <[email protected]>', 'author': 'Ilya Etingof', 'author_email': '[email protected]', 'url': 'http://sourceforge.net/projects/pyasn1/', - 'classifiers': [ - 'Development Status :: 5 - Production/Stable', - 'Intended Audience :: Developers', - 'Intended Audience :: Information Technology', - 'Intended Audience :: Telecommunications Industry', - 'Operating System :: OS Independent', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 3', - 'Topic :: Communications', - 'Topic :: Security :: Cryptography', - 'Topic :: Software Development :: Libraries :: Python Modules', - 'License :: OSI Approved :: BSD License' - ], + 'platforms': ['any'], + 'classifiers': [ x for x in classifiers.split('\n') if x ], 'license': 'BSD', 'packages': [ 'pyasn1_modules' ] } ) diff -Nru python-pyasn1-modules-0.0.3/test/cmp.sh python-pyasn1-modules-0.0.5/test/cmp.sh --- python-pyasn1-modules-0.0.3/test/cmp.sh 1970-01-01 00:00:00.000000000 +0000 +++ python-pyasn1-modules-0.0.5/test/cmp.sh 2012-05-30 15:26:19.000000000 +0000 @@ -0,0 +1,93 @@ +#!/bin/sh + +cmpdump.py <<EOT +MIITuTCCARECAQKkWTBXMQswCQYDVQQGEwJU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MdCsxVVhpRRE6jQAyyR9YEBHQYVLfy34e3+9G/h/BR73VGHZJdZI +DDJYd+VWXmUD9kGk/mI35qYdzN3O28KI8sokqX0z2hvkpDKuP4jNXSCHcVkK23tX2x5m6m0LdqVn +vnCx2LfBn1wf1u7q30p/GgMVX+mR3QHs7feGewEjlkxuEyLVVD+uBwWCT6zcad17oaAyXV5RV28L +vH0WNg6pFUpwOP0l+nIOqqCBhAOBgQBAtTB5Qd18sTxEKhSzRiN2OycFPrqoqlZZTHBohe8bE2D4 +Xc1ejkFWUEvQivkqJxCD6C7I37xgDaq8DZnaczIBxbPkY0QMdeL4MiEqlw/tlrJGrWoC5Twb0t/m +JA5RSwQoMDYTj2WrwtM/nsP12T39or4JRZhlLSM43IaTwEBtQw== +EOT diff -Nru python-pyasn1-modules-0.0.3/tools/cmpdump.py python-pyasn1-modules-0.0.5/tools/cmpdump.py --- python-pyasn1-modules-0.0.3/tools/cmpdump.py 1970-01-01 00:00:00.000000000 +0000 +++ python-pyasn1-modules-0.0.5/tools/cmpdump.py 2012-05-24 14:39:48.000000000 +0000 @@ -0,0 +1,28 @@ +#!/usr/bin/python +# Read ASN.1/PEM CMP message on stdin, parse into +# plain text, then build substrate from it +from pyasn1.codec.der import decoder, encoder +from pyasn1_modules import rfc4210, pem +from pyasn1 import debug +import sys + +if len(sys.argv) == 2 and sys.argv[1] == '-d': + debug.setLogger(debug.Debug('all')) +elif len(sys.argv) != 1: + print("""Usage: +$ cat cmp.pem | %s [-d]""" % sys.argv[0]) + sys.exit(-1) + +pkiMessage = rfc4210.PKIMessage() + +substrate = pem.readBase64FromFile(sys.stdin) +if not substrate: + sys.exit(0) + +pkiMsg, rest = decoder.decode(substrate, asn1Spec=pkiMessage) + +print(pkiMsg.prettyPrint()) + +assert encoder.encode(pkiMsg, defMode=False) == substrate or \ + encoder.encode(pkiMsg, defMode=True) == substrate, \ + 'CMP message recode fails' diff -Nru python-pyasn1-modules-0.0.3/tools/ocspserver.py python-pyasn1-modules-0.0.5/tools/ocspserver.py --- python-pyasn1-modules-0.0.3/tools/ocspserver.py 1970-01-01 00:00:00.000000000 +0000 +++ python-pyasn1-modules-0.0.5/tools/ocspserver.py 2012-04-11 09:39:42.000000000 +0000 @@ -0,0 +1,143 @@ +#!/usr/bin/python +# +from pyasn1.codec.der import decoder, encoder +from pyasn1_modules import rfc2560, rfc2459, pem +from pyasn1.type import univ +import sys, hashlib +try: + import urllib2 +except ImportError: + import urllib.request as urllib2 + +sha1oid = univ.ObjectIdentifier((1, 3, 14, 3, 2, 26)) + +class ValueOnlyBitStringEncoder(encoder.encoder.BitStringEncoder): + # These methods just do not encode tag and length fields of TLV + def encodeTag(self, *args): return '' + def encodeLength(self, *args): return '' + def encodeValue(*args): + substrate, isConstructed = encoder.encoder.BitStringEncoder.encodeValue(*args) + # OCSP-specific hack follows: cut off the "unused bit count" + # encoded bit-string value. + return substrate[1:], isConstructed + + def __call__(self, bitStringValue): + return self.encode(None, bitStringValue, defMode=1, maxChunkSize=0) + +valueOnlyBitStringEncoder = ValueOnlyBitStringEncoder() + +def mkOcspRequest(issuerCert, userCert): + issuerTbsCertificate = issuerCert.getComponentByName('tbsCertificate') + issuerSubject = issuerTbsCertificate.getComponentByName('subject') + + userTbsCertificate = userCert.getComponentByName('tbsCertificate') + userIssuer = userTbsCertificate.getComponentByName('issuer') + + assert issuerSubject == userIssuer, '%s\n%s' % ( + issuerSubject.prettyPrint(), userIssuer.prettyPrint() + ) + + userIssuerHash = hashlib.sha1( + encoder.encode(userIssuer) + ).digest() + + issuerSubjectPublicKey = issuerTbsCertificate.getComponentByName('subjectPublicKeyInfo').getComponentByName('subjectPublicKey') + + issuerKeyHash = hashlib.sha1( + valueOnlyBitStringEncoder(issuerSubjectPublicKey) + ).digest() + + userSerialNumber = userTbsCertificate.getComponentByName('serialNumber') + + # Build request object + + request = rfc2560.Request() + + reqCert = request.setComponentByName('reqCert').getComponentByName('reqCert') + + hashAlgorithm = reqCert.setComponentByName('hashAlgorithm').getComponentByName('hashAlgorithm') + hashAlgorithm.setComponentByName('algorithm', sha1oid) + + reqCert.setComponentByName('issuerNameHash', userIssuerHash) + reqCert.setComponentByName('issuerKeyHash', issuerKeyHash) + reqCert.setComponentByName('serialNumber', userSerialNumber) + + ocspRequest = rfc2560.OCSPRequest() + + tbsRequest = ocspRequest.setComponentByName('tbsRequest').getComponentByName('tbsRequest') + tbsRequest.setComponentByName('version', 'v1') + + requestList = tbsRequest.setComponentByName('requestList').getComponentByName('requestList') + requestList.setComponentByPosition(0, request) + + return ocspRequest + +def parseOcspRequest(ocspRequest): + tbsRequest = ocspRequest['responseStatus'] + + assert responseStatus == rfc2560.OCSPResponseStatus('successful'), responseStatus.prettyPrint() + responseBytes = ocspResponse.getComponentByName('responseBytes') + responseType = responseBytes.getComponentByName('responseType') + assert responseType == id_pkix_ocsp_basic, responseType.prettyPrint() + + response = responseBytes.getComponentByName('response') + + basicOCSPResponse, _ = decoder.decode( + response, asn1Spec=rfc2560.BasicOCSPResponse() + ) + + tbsResponseData = basicOCSPResponse.getComponentByName('tbsResponseData') + + response0 = tbsResponseData.getComponentByName('responses').getComponentByPosition(0) + + return ( + tbsResponseData.getComponentByName('producedAt'), + response0.getComponentByName('certID'), + response0.getComponentByName('certStatus').getName(), + response0.getComponentByName('thisUpdate') + ) + +if len(sys.argv) != 2: + print("""Usage: +$ cat CACertificate.pem userCertificate.pem | %s <ocsp-responder-url>""" % sys.argv[0]) + sys.exit(-1) +else: + ocspUrl = sys.argv[1] + +# Parse CA and user certificates + +issuerCert, _ = decoder.decode( + pem.readPemFromFile(sys.stdin)[1], + asn1Spec=rfc2459.Certificate() + ) +userCert, _ = decoder.decode( + pem.readPemFromFile(sys.stdin)[1], + asn1Spec=rfc2459.Certificate() + ) + +# Build OCSP request + +ocspReq = mkOcspRequest(issuerCert, userCert) + +# Use HTTP POST to get response (see Appendix A of RFC 2560) +# In case you need proxies, set the http_proxy env variable + +httpReq = urllib2.Request( + ocspUrl, + encoder.encode(ocspReq), + { 'Content-Type': 'application/ocsp-request' } + ) +httpRsp = urllib2.urlopen(httpReq).read() + +# Process OCSP response + +ocspRsp, _ = decoder.decode(httpRsp, asn1Spec=rfc2560.OCSPResponse()) + +producedAt, certId, certStatus, thisUpdate = parseOcspResponse(ocspRsp) + +print('Certificate ID %s is %s at %s till %s\n' % ( + certId.getComponentByName('serialNumber'), + certStatus, + producedAt, + thisUpdate + ))

