示例#1
0
def test_keypair_faulty():
    LOGGER.info('Try to use faulty curves and keyid')
    with pytest.raises(ValueError):
        rsa.generate_keypair(key_size='102')

    with pytest.raises(ValueError):
        rsa.generate_keypair(keyid=KeyId.ECC_KEY_E0F1)
示例#2
0
def test_keypair_2k():
    LOGGER.info('Generate an RSA2048 keypair')
    k = rsa.generate_keypair(key_size='2048')
    assert isinstance(k.pkey, bytes)
    assert len(k.pkey) > 0
    assert k.algorithm is 'rsa'
    assert k.keyid == KeyId.RSA_KEY_E0FC
    assert k.key_size == 2048
示例#3
0
def test_keypair_default():
    LOGGER.info('Generate a keypair using default parameters')
    k = rsa.generate_keypair()
    assert isinstance(k.pkey, bytes)
    assert len(k.pkey) > 0
    assert k.algorithm is 'rsa'
    assert k.keyid in KeyId
    assert k.key_size == 1024
示例#4
0
def test_keypair_2k_keyid(ki):
    LOGGER.info(
        'Generate a RSA2048 keypair for a specific Object ID {0}'.format(ki))
    k = rsa.generate_keypair(key_size='2048', keyid=ki)
    assert isinstance(k.pkey, bytes)
    assert len(k.pkey) > 0
    assert k.algorithm is 'rsa'
    assert k.keyid == ki
    assert k.key_size == 2048
示例#5
0
def setup_keys_2k():
	pytest.twok = rsa.generate_keypair(key_size='2048', keyid=KeyId.RSA_KEY_E0FC)
	pytest.twok_fail = rsa.generate_keypair(key_size='2048', keyid=KeyId.RSA_KEY_E0FD)
示例#6
0
def setup_keys_1k():
	pytest.onek = rsa.generate_keypair(key_size='1024', keyid=KeyId.RSA_KEY_E0FC)
	pytest.onek_fail = rsa.generate_keypair(key_size='1024', keyid=KeyId.RSA_KEY_E0FD)