# Path: asn1crypto/csr.py
# class Version(Integer):
# class CSRAttributeType(ObjectIdentifier):
# class SetOfDirectoryString(SetOf):
# class Attribute(Sequence):
# class SetOfAttributes(SetOf):
# class SetOfExtensions(SetOf):
# class MicrosoftEnrollmentCSProvider(Sequence):
# class SetOfMicrosoftEnrollmentCSProvider(SetOf):
# class MicrosoftRequestClientInfo(Sequence):
# class SetOfMicrosoftRequestClientInfo(SetOf):
# class CRIAttribute(Sequence):
# class CRIAttributes(SetOf):
# class CertificationRequestInfo(Sequence):
# class CertificationRequest(Sequence):
# 
# Path: asn1crypto/util.py
#     def int_to_bytes(value, signed=False, width=None):
#     def int_from_bytes(value, signed=False):
#         def __init__(self, offset, name=None):
#         def __eq__(self, other):
#         def __getinitargs__(self):
#         def tzname(self, dt):
#         def utcoffset(self, dt):
#         def dst(self, dt):
#     def int_to_bytes(value, signed=False, width=None):
#     def int_from_bytes(value, signed=False):
# def _format_offset(off):
#     def tzname(self, dt):
#     def utcoffset(self, dt):
#     def dst(self, dt):
# def create_timezone(offset):
#     def __init__(self, year, month, day):
#     def year(self):
#     def month(self):
#     def day(self):
#     def strftime(self, format):
#     def isoformat(self):
#     def replace(self, year=None, month=None, day=None):
#     def __str__(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def _comparison_error(self, other):
#     def __cmp__(self, other):
#     def __lt__(self, other):
#     def __le__(self, other):
#     def __gt__(self, other):
#     def __ge__(self, other):
#     def __init__(self, year, *args, **kwargs):
#     def year(self):
#     def month(self):
#     def day(self):
#     def hour(self):
#     def minute(self):
#     def second(self):
#     def microsecond(self):
#     def tzinfo(self):
#     def utcoffset(self):
#     def time(self):
#     def date(self):
#     def strftime(self, format):
#     def isoformat(self, sep='T'):
#     def replace(self, year=None, *args, **kwargs):
#     def astimezone(self, tz):
#     def timestamp(self):
#     def __str__(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def _comparison_error(self, other):
#     def __cmp__(self, other):
#     def __lt__(self, other):
#     def __le__(self, other):
#     def __gt__(self, other):
#     def __ge__(self, other):
#     def __add__(self, other):
#     def __sub__(self, other):
#     def __rsub__(self, other):
#     def from_y2k(cls, value):
#     class timezone(tzinfo):  # noqa
# class _UtcWithDst(tzinfo):
# class extended_date(object):
# class extended_datetime(object):
#     DAYS_IN_400_YEARS = 400 * 365 + 97
#     DAYS_IN_2000_YEARS = 5 * DAYS_IN_400_YEARS


import unittest
import sys
import os
from asn1crypto import csr, util
from ._unittest_compat import patch
                ('locality_name', 'Newbury'),
                ('organization_name', 'Codex Non Sufficit LC'),
                ('organizational_unit_name', 'Testing Intermediate'),
                ('common_name', 'Will Bond'),
                ('email_address', 'will@codexns.io'),
            ]),
            cri['subject'].native
        )
        self.assertEqual(
            util.OrderedDict([
                ('algorithm', 'rsa'),
                ('parameters', None),
            ]),
            cri['subject_pk_info']['algorithm'].native
        )
        self.assertEqual(
            24141757533938720807477509823483015516687050697622322097001928034085434547050399731881871694642845241206788286795830006142635608141713689209738431462004600429798152826994774062467402648660593454536565119527837471261495586474194846971065722669734666949739228862107500673350843489920495869942508240779131331715037662761414997889327943217889802893638175792326783316531272170879284118280173511200768884738639370318760377047837471530387161553030663446359575963736475504659902898072137674205021477968813148345198711103071746476009234601299344030395455052526948041544669303473529511160643491569274897838845918784633403435929,  # noqa
            cri['subject_pk_info']['public_key'].parsed['modulus'].native
        )
        self.assertEqual(
            65537,
            cri['subject_pk_info']['public_key'].parsed['public_exponent'].native
        )
        self.assertEqual(
            [],
            cri['attributes'].native
        )

    def test_parse_csr2(self):
        with open(os.path.join(fixtures_dir, 'test-third-der.csr'), 'rb') as f:

# Path: asn1crypto/csr.py
# class Version(Integer):
# class CSRAttributeType(ObjectIdentifier):
# class SetOfDirectoryString(SetOf):
# class Attribute(Sequence):
# class SetOfAttributes(SetOf):
# class SetOfExtensions(SetOf):
# class MicrosoftEnrollmentCSProvider(Sequence):
# class SetOfMicrosoftEnrollmentCSProvider(SetOf):
# class MicrosoftRequestClientInfo(Sequence):
# class SetOfMicrosoftRequestClientInfo(SetOf):
# class CRIAttribute(Sequence):
# class CRIAttributes(SetOf):
# class CertificationRequestInfo(Sequence):
# class CertificationRequest(Sequence):
# 
# Path: asn1crypto/util.py
#     def int_to_bytes(value, signed=False, width=None):
#     def int_from_bytes(value, signed=False):
#         def __init__(self, offset, name=None):
#         def __eq__(self, other):
#         def __getinitargs__(self):
#         def tzname(self, dt):
#         def utcoffset(self, dt):
#         def dst(self, dt):
#     def int_to_bytes(value, signed=False, width=None):
#     def int_from_bytes(value, signed=False):
# def _format_offset(off):
#     def tzname(self, dt):
#     def utcoffset(self, dt):
#     def dst(self, dt):
# def create_timezone(offset):
#     def __init__(self, year, month, day):
#     def year(self):
#     def month(self):
#     def day(self):
#     def strftime(self, format):
#     def isoformat(self):
#     def replace(self, year=None, month=None, day=None):
#     def __str__(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def _comparison_error(self, other):
#     def __cmp__(self, other):
#     def __lt__(self, other):
#     def __le__(self, other):
#     def __gt__(self, other):
#     def __ge__(self, other):
#     def __init__(self, year, *args, **kwargs):
#     def year(self):
#     def month(self):
#     def day(self):
#     def hour(self):
#     def minute(self):
#     def second(self):
#     def microsecond(self):
#     def tzinfo(self):
#     def utcoffset(self):
#     def time(self):
#     def date(self):
#     def strftime(self, format):
#     def isoformat(self, sep='T'):
#     def replace(self, year=None, *args, **kwargs):
#     def astimezone(self, tz):
#     def timestamp(self):
#     def __str__(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def _comparison_error(self, other):
#     def __cmp__(self, other):
#     def __lt__(self, other):
#     def __le__(self, other):
#     def __gt__(self, other):
#     def __ge__(self, other):
#     def __add__(self, other):
#     def __sub__(self, other):
#     def __rsub__(self, other):
#     def from_y2k(cls, value):
#     class timezone(tzinfo):  # noqa
# class _UtcWithDst(tzinfo):
# class extended_date(object):
# class extended_datetime(object):
#     DAYS_IN_400_YEARS = 400 * 365 + 97
#     DAYS_IN_2000_YEARS = 5 * DAYS_IN_400_YEARS


# Path: tests/test_csr.py
import unittest
import sys
import os
from asn1crypto import csr, util
from ._unittest_compat import patch

                ('locality_name', 'Newbury'),
                ('organization_name', 'Codex Non Sufficit LC'),
                ('organizational_unit_name', 'Testing Intermediate'),
                ('common_name', 'Will Bond'),
                ('email_address', 'will@codexns.io'),
            ]),
            cri['subject'].native
        )
        self.assertEqual(
            util.OrderedDict([
                ('algorithm', 'rsa'),
                ('parameters', None),
            ]),
            cri['subject_pk_info']['algorithm'].native
        )
        self.assertEqual(
            24141757533938720807477509823483015516687050697622322097001928034085434547050399731881871694642845241206788286795830006142635608141713689209738431462004600429798152826994774062467402648660593454536565119527837471261495586474194846971065722669734666949739228862107500673350843489920495869942508240779131331715037662761414997889327943217889802893638175792326783316531272170879284118280173511200768884738639370318760377047837471530387161553030663446359575963736475504659902898072137674205021477968813148345198711103071746476009234601299344030395455052526948041544669303473529511160643491569274897838845918784633403435929,  # noqa
            cri['subject_pk_info']['public_key'].parsed['modulus'].native
        )
        self.assertEqual(
            65537,
            cri['subject_pk_info']['public_key'].parsed['public_exponent'].native
        )
        self.assertEqual(
            [],
            cri['attributes'].native
        )

    def test_parse_csr2(self):
        with open(os.path.join(fixtures_dir, 'test-third-der.csr'), 'rb') as f:

            certification_request = csr.CertificationRequest.load(f.read())