コード例 #1
0
 def test_oid_dotted_decimal(self):
     self.assertEqual(nss.oid_dotted_decimal(nss.SEC_OID_AVA_COMMON_NAME),
                      'OID.2.5.4.3')
     self.assertEqual(nss.oid_tag('OID.2.5.4.3'),
                      nss.SEC_OID_AVA_COMMON_NAME)
     self.assertEqual(nss.oid_tag('2.5.4.3'), nss.SEC_OID_AVA_COMMON_NAME)
     self.assertRaises(ValueError, nss.oid_tag, 'OID.99.99.99.99')
コード例 #2
0
 def test_oid_dotted_decimal(self):
     self.assertEqual(nss.oid_dotted_decimal(nss.SEC_OID_AVA_COMMON_NAME),
                      'OID.2.5.4.3')
     self.assertEqual(nss.oid_tag('OID.2.5.4.3'),
                      nss.SEC_OID_AVA_COMMON_NAME)
     self.assertEqual(nss.oid_tag('2.5.4.3'),
                      nss.SEC_OID_AVA_COMMON_NAME)
     self.assertRaises(ValueError, nss.oid_tag, 'OID.99.99.99.99')
コード例 #3
0
ファイル: pkcs10.py プロジェクト: AvidehST/freeipa
def get_extensions(csr, datatype=PEM):
    """
    Given a CSR return OIDs of certificate extensions.

    The return value is a tuple of strings
    """
    request = load_certificate_request(csr, datatype)
    return tuple(nss.oid_dotted_decimal(ext.oid_tag)[4:]
                 for ext in request.extensions)
コード例 #4
0
def get_extensions(csr, datatype=PEM):
    """
    Given a CSR return OIDs of certificate extensions.

    The return value is a tuple of strings
    """
    request = load_certificate_request(csr, datatype)
    return tuple(
        nss.oid_dotted_decimal(ext.oid_tag)[4:] for ext in request.extensions)
コード例 #5
0
    def test_oid(self):
        self.assertEqual(nss.oid_str('2.5.4.3'), 'X520 Common Name')
        self.assertEqual(nss.oid_str(nss.SEC_OID_AVA_COMMON_NAME),
                         'X520 Common Name')
        self.assertEqual(nss.oid_str('SEC_OID_AVA_COMMON_NAME'),
                         'X520 Common Name')
        self.assertEqual(nss.oid_str('AVA_COMMON_NAME'), 'X520 Common Name')
        self.assertEqual(nss.oid_str('cn'), 'X520 Common Name')

        self.assertEqual(nss.oid_tag_name('2.5.4.3'),
                         'SEC_OID_AVA_COMMON_NAME')
        self.assertEqual(nss.oid_tag_name(nss.SEC_OID_AVA_COMMON_NAME),
                         'SEC_OID_AVA_COMMON_NAME')
        self.assertEqual(nss.oid_tag_name('SEC_OID_AVA_COMMON_NAME'),
                         'SEC_OID_AVA_COMMON_NAME')
        self.assertEqual(nss.oid_tag_name('AVA_COMMON_NAME'),
                         'SEC_OID_AVA_COMMON_NAME')
        self.assertEqual(nss.oid_tag_name('cn'), 'SEC_OID_AVA_COMMON_NAME')

        self.assertEqual(nss.oid_dotted_decimal('2.5.4.3'), 'OID.2.5.4.3')
        self.assertEqual(nss.oid_dotted_decimal(nss.SEC_OID_AVA_COMMON_NAME),
                         'OID.2.5.4.3')
        self.assertEqual(nss.oid_dotted_decimal('SEC_OID_AVA_COMMON_NAME'),
                         'OID.2.5.4.3')
        self.assertEqual(nss.oid_dotted_decimal('AVA_COMMON_NAME'),
                         'OID.2.5.4.3')
        self.assertEqual(nss.oid_dotted_decimal('cn'), 'OID.2.5.4.3')

        self.assertEqual(nss.oid_tag('2.5.4.3'), nss.SEC_OID_AVA_COMMON_NAME)
        self.assertEqual(nss.oid_tag(nss.SEC_OID_AVA_COMMON_NAME),
                         nss.SEC_OID_AVA_COMMON_NAME)
        self.assertEqual(nss.oid_tag('SEC_OID_AVA_COMMON_NAME'),
                         nss.SEC_OID_AVA_COMMON_NAME)
        self.assertEqual(nss.oid_tag('AVA_COMMON_NAME'),
                         nss.SEC_OID_AVA_COMMON_NAME)
        self.assertEqual(nss.oid_tag('cn'), nss.SEC_OID_AVA_COMMON_NAME)
コード例 #6
0
    def test_oid(self):
        self.assertEqual(nss.oid_str('2.5.4.3'),                   'X520 Common Name')
        self.assertEqual(nss.oid_str(nss.SEC_OID_AVA_COMMON_NAME), 'X520 Common Name')
        self.assertEqual(nss.oid_str('SEC_OID_AVA_COMMON_NAME'),   'X520 Common Name')
        self.assertEqual(nss.oid_str('AVA_COMMON_NAME'),           'X520 Common Name')
        self.assertEqual(nss.oid_str('cn'),                        'X520 Common Name')

        self.assertEqual(nss.oid_tag_name('2.5.4.3'),                   'SEC_OID_AVA_COMMON_NAME')
        self.assertEqual(nss.oid_tag_name(nss.SEC_OID_AVA_COMMON_NAME), 'SEC_OID_AVA_COMMON_NAME')
        self.assertEqual(nss.oid_tag_name('SEC_OID_AVA_COMMON_NAME'),   'SEC_OID_AVA_COMMON_NAME')
        self.assertEqual(nss.oid_tag_name('AVA_COMMON_NAME'),           'SEC_OID_AVA_COMMON_NAME')
        self.assertEqual(nss.oid_tag_name('cn'),                        'SEC_OID_AVA_COMMON_NAME')

        self.assertEqual(nss.oid_dotted_decimal('2.5.4.3'),                   'OID.2.5.4.3')
        self.assertEqual(nss.oid_dotted_decimal(nss.SEC_OID_AVA_COMMON_NAME), 'OID.2.5.4.3')
        self.assertEqual(nss.oid_dotted_decimal('SEC_OID_AVA_COMMON_NAME'),   'OID.2.5.4.3')
        self.assertEqual(nss.oid_dotted_decimal('AVA_COMMON_NAME'),           'OID.2.5.4.3')
        self.assertEqual(nss.oid_dotted_decimal('cn'),                        'OID.2.5.4.3')

        self.assertEqual(nss.oid_tag('2.5.4.3'),                   nss.SEC_OID_AVA_COMMON_NAME)
        self.assertEqual(nss.oid_tag(nss.SEC_OID_AVA_COMMON_NAME), nss.SEC_OID_AVA_COMMON_NAME)
        self.assertEqual(nss.oid_tag('SEC_OID_AVA_COMMON_NAME'),   nss.SEC_OID_AVA_COMMON_NAME)
        self.assertEqual(nss.oid_tag('AVA_COMMON_NAME'),           nss.SEC_OID_AVA_COMMON_NAME)
        self.assertEqual(nss.oid_tag('cn'),                        nss.SEC_OID_AVA_COMMON_NAME)
コード例 #7
0
ファイル: pkcs10.py プロジェクト: pspacek/freeipa
 def get_prefixed_oid_str(ext):
     """Returns a string like 'OID.1.2...'."""
     if ext.oid_tag == 0:
         return repr(ext)
     else:
         return nss.oid_dotted_decimal(ext.oid)
コード例 #8
0
ファイル: pkcs10.py プロジェクト: miradam/python-ipalib
 def get_prefixed_oid_str(ext):
     """Returns a string like 'OID.1.2...'."""
     if ext.oid_tag == 0:
         return repr(ext)
     else:
         return nss.oid_dotted_decimal(ext.oid)