当前位置: 首页>>代码示例>>Python>>正文


Python core.Integer方法代码示例

本文整理汇总了Python中asn1crypto.core.Integer方法的典型用法代码示例。如果您正苦于以下问题:Python core.Integer方法的具体用法?Python core.Integer怎么用?Python core.Integer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在asn1crypto.core的用法示例。


在下文中一共展示了core.Integer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: compare_primitive_info

# 需要导入模块: from asn1crypto import core [as 别名]
# 或者: from asn1crypto.core import Integer [as 别名]
def compare_primitive_info():
        return (
            (core.ObjectIdentifier('1.2.3'), core.ObjectIdentifier('1.2.3'), True),
            (core.Integer(1), Enum(1), False),
            (core.Integer(1), core.Integer(1, implicit=5), True),
            (core.Integer(1), core.Integer(1, explicit=5), True),
            (core.Integer(1), core.Integer(2), False),
            (core.OctetString(b''), core.OctetString(b''), True),
            (core.OctetString(b''), core.OctetString(b'1'), False),
            (core.OctetString(b''), core.OctetBitString(b''), False),
            (core.ParsableOctetString(b'12'), core.OctetString(b'12'), True),
            (core.ParsableOctetBitString(b'12'), core.OctetBitString(b'12'), True),
            (core.UTF8String('12'), core.UTF8String('12'), True),
            (core.UTF8String('12'), core.UTF8String('1'), False),
            (core.UTF8String('12'), core.IA5String('12'), False),
        ) 
开发者ID:wbond,项目名称:asn1crypto,代码行数:18,代码来源:test_core.py

示例2: test_dsa_public_key_unwrap

# 需要导入模块: from asn1crypto import core [as 别名]
# 或者: from asn1crypto.core import Integer [as 别名]
def test_dsa_public_key_unwrap(self):
        public = asymmetric.load_public_key(os.path.join(fixtures_dir, 'keys/test-dsa-1024.crt'))
        self.assertIsInstance(public.unwrap(), core.Integer) 
开发者ID:wbond,项目名称:oscrypto,代码行数:5,代码来源:test_asymmetric.py

示例3: test_sequence_spec

# 需要导入模块: from asn1crypto import core [as 别名]
# 或者: from asn1crypto.core import Integer [as 别名]
def test_sequence_spec(self):
        seq = Seq()
        seq['id'] = '1.2.3'
        self.assertEqual(core.Integer, seq.spec('value'))
        seq['id'] = '2.3.4'
        self.assertEqual(core.OctetString, seq.spec('value')) 
开发者ID:wbond,项目名称:asn1crypto,代码行数:8,代码来源:test_core.py

示例4: integer

# 需要导入模块: from asn1crypto import core [as 别名]
# 或者: from asn1crypto.core import Integer [as 别名]
def integer(self, native, der_bytes):
        i = core.Integer(native)
        self.assertEqual(der_bytes, i.dump())
        self.assertEqual(native, core.Integer.load(der_bytes).native) 
开发者ID:wbond,项目名称:asn1crypto,代码行数:6,代码来源:test_core.py

示例5: test_load

# 需要导入模块: from asn1crypto import core [as 别名]
# 或者: from asn1crypto.core import Integer [as 别名]
def test_load(self):
        i = core.load(b'\x02\x01\x00')
        self.assertIsInstance(i, core.Integer)
        self.assertEqual(0, i.native) 
开发者ID:wbond,项目名称:asn1crypto,代码行数:6,代码来源:test_core.py

示例6: test_strict_on_class

# 需要导入模块: from asn1crypto import core [as 别名]
# 或者: from asn1crypto.core import Integer [as 别名]
def test_strict_on_class(self):
        with self.assertRaises(ValueError):
            core.Integer.load(b'\x02\x01\x00\x00', strict=True) 
开发者ID:wbond,项目名称:asn1crypto,代码行数:5,代码来源:test_core.py

示例7: test_sequence_any_asn1value

# 需要导入模块: from asn1crypto import core [as 别名]
# 或者: from asn1crypto.core import Integer [as 别名]
def test_sequence_any_asn1value(self):
        seq = SequenceAny()
        seq.append(core.Integer(5))
        self.assertEqual([5], seq.native) 
开发者ID:wbond,项目名称:asn1crypto,代码行数:6,代码来源:test_core.py

示例8: test_copy

# 需要导入模块: from asn1crypto import core [as 别名]
# 或者: from asn1crypto.core import Integer [as 别名]
def test_copy(self):
        a = core.Integer(200)
        b = a.copy()
        self.assertNotEqual(id(a), id(b))
        self.assertEqual(a.contents, b.contents)
        self.assertEqual(a.dump(), b.dump()) 
开发者ID:wbond,项目名称:asn1crypto,代码行数:8,代码来源:test_core.py

示例9: test_retag

# 需要导入模块: from asn1crypto import core [as 别名]
# 或者: from asn1crypto.core import Integer [as 别名]
def test_retag(self):
        a = core.Integer(200)
        b = a.retag('explicit', 0)
        self.assertNotEqual(id(a), id(b))
        self.assertEqual(a.contents, b.contents)
        self.assertNotEqual(a.dump(), b.dump()) 
开发者ID:wbond,项目名称:asn1crypto,代码行数:8,代码来源:test_core.py

示例10: test_untag

# 需要导入模块: from asn1crypto import core [as 别名]
# 或者: from asn1crypto.core import Integer [as 别名]
def test_untag(self):
        a = core.Integer(200, explicit=0)
        b = a.untag()
        self.assertNotEqual(id(a), id(b))
        self.assertEqual(a.contents, b.contents)
        self.assertNotEqual(a.dump(), b.dump()) 
开发者ID:wbond,项目名称:asn1crypto,代码行数:8,代码来源:test_core.py

示例11: test_fix_tagging_choice

# 需要导入模块: from asn1crypto import core [as 别名]
# 或者: from asn1crypto.core import Integer [as 别名]
def test_fix_tagging_choice(self):
        correct = core.Integer(200, explicit=2)
        choice = NumChoice(
            name='three',
            value=core.Integer(200, explicit=1)
        )
        self.assertEqual(correct.dump(), choice.dump())
        self.assertEqual(correct.explicit, choice.chosen.explicit)
        choice2 = NumChoiceOldApi(
            name='three',
            value=core.Integer(200, explicit=1)
        )
        self.assertEqual(correct.dump(), choice2.dump())
        self.assertEqual(correct.explicit, choice2.chosen.explicit) 
开发者ID:wbond,项目名称:asn1crypto,代码行数:16,代码来源:test_core.py

示例12: test_required_field

# 需要导入模块: from asn1crypto import core [as 别名]
# 或者: from asn1crypto.core import Integer [as 别名]
def test_required_field(self):
        with self.assertRaisesRegex(ValueError, '"id" is missing from structure'):
            Seq({'value': core.Integer(5)}).dump() 
开发者ID:wbond,项目名称:asn1crypto,代码行数:5,代码来源:test_core.py

示例13: test_wrong_asn1value

# 需要导入模块: from asn1crypto import core [as 别名]
# 或者: from asn1crypto.core import Integer [as 别名]
def test_wrong_asn1value(self):
        with self.assertRaises(TypeError):
            Seq({
                'id': core.Integer(1),
                'value': 1
            }) 
开发者ID:wbond,项目名称:asn1crypto,代码行数:8,代码来源:test_core.py

示例14: test_wrong_asn1value2

# 需要导入模块: from asn1crypto import core [as 别名]
# 或者: from asn1crypto.core import Integer [as 别名]
def test_wrong_asn1value2(self):
        with self.assertRaises(TypeError):
            CopySeq({
                'name': core.UTF8String('Test'),
                'pair': core.Integer(1)
            }) 
开发者ID:wbond,项目名称:asn1crypto,代码行数:8,代码来源:test_core.py

示例15: test_wrong_asn1value3

# 需要导入模块: from asn1crypto import core [as 别名]
# 或者: from asn1crypto.core import Integer [as 别名]
def test_wrong_asn1value3(self):
        with self.assertRaises(TypeError):
            NestSeqAny({
                'id': '3.4.5',
                'value': core.Integer(1)
            }) 
开发者ID:wbond,项目名称:asn1crypto,代码行数:8,代码来源:test_core.py


注:本文中的asn1crypto.core.Integer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。