def test_files_permissions(bls_key_manager_file):
    sk = json.dumps(
        {'aaa': 'bbb', 'ccc': 'ddd'})
    pk = json.dumps(
        {'333': '222', '111': '000'})
    bls_key_manager_file.save_keys(sk, pk)
    sk_file = os.path.join(bls_key_manager_file._bls_keys_dir, bls_key_manager_file.BLS_SK_FILE_NAME)
    pk_file = os.path.join(bls_key_manager_file._bls_keys_dir, bls_key_manager_file.BLS_PK_FILE_NAME)
    assert '600' == get_file_permission_mask(sk_file)
    assert '644' == get_file_permission_mask(pk_file)
Esempio n. 2
0
def test_files_permissions(bls_key_manager_file):
    sk = json.dumps({'aaa': 'bbb', 'ccc': 'ddd'})
    pk = json.dumps({'333': '222', '111': '000'})
    bls_key_manager_file.save_keys(sk, pk)
    sk_file = os.path.join(bls_key_manager_file._bls_keys_dir,
                           bls_key_manager_file.BLS_SK_FILE_NAME)
    pk_file = os.path.join(bls_key_manager_file._bls_keys_dir,
                           bls_key_manager_file.BLS_PK_FILE_NAME)
    assert '600' == get_file_permission_mask(sk_file)
    assert '644' == get_file_permission_mask(pk_file)
Esempio n. 3
0
def test_zstack_creates_keys_with_secure_permissions(tdir):
    any_seed = b'0' * 32
    stack_name = 'aStack'
    key_paths = get_zstack_key_paths(stack_name, tdir)

    ZStack.initLocalKeys(stack_name, tdir, any_seed)

    for file_path in key_paths['secret']:
        assert get_file_permission_mask(file_path) == '600'

    for file_path in key_paths['public']:
        assert get_file_permission_mask(file_path) == '644'
Esempio n. 4
0
def test_zstack_creates_keys_with_secure_permissions(tdir):
    any_seed = b'0' * 32
    stack_name = 'aStack'
    key_paths = get_zstack_key_paths(stack_name, tdir)

    ZStack.initLocalKeys(stack_name, tdir, any_seed)

    for file_path in key_paths['secret']:
        assert get_file_permission_mask(file_path) == '600'

    for file_path in key_paths['public']:
        assert get_file_permission_mask(file_path) == '644'
def test_key_dir(bls_key_manager_file):
    assert bls_key_manager_file._bls_keys_dir
    assert os.path.isdir(bls_key_manager_file._bls_keys_dir)
    assert '744' == get_file_permission_mask(bls_key_manager_file._bls_keys_dir)
Esempio n. 6
0
def test_key_dir(bls_key_manager_file):
    assert bls_key_manager_file._bls_keys_dir
    assert os.path.isdir(bls_key_manager_file._bls_keys_dir)
    assert '744' == get_file_permission_mask(
        bls_key_manager_file._bls_keys_dir)
Esempio n. 7
0
def test_create_certs_from_fromkeys_sets_600_for_secret_644_for_pub_keys(tdir):
    public_key_file, secret_key_file = createCertsFromKeys(
        tdir, 'akey', b'0123456789')
    assert get_file_permission_mask(secret_key_file) == '600'
    assert get_file_permission_mask(public_key_file) == '644'