1 /*
2  * The volume key bag functions
3  *
4  * Copyright (C) 2018-2021, Joachim Metz <joachim.metz@gmail.com>
5  *
6  * Refer to AUTHORS for acknowledgements.
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20  */
21 
22 #if !defined( _LIBFSAPFS_VOLUME_KEY_BAG_H )
23 #define _LIBFSAPFS_VOLUME_KEY_BAG_H
24 
25 #include <common.h>
26 #include <types.h>
27 
28 #include "libfsapfs_io_handle.h"
29 #include "libfsapfs_libbfio.h"
30 #include "libfsapfs_libcdata.h"
31 #include "libfsapfs_libcerror.h"
32 
33 #if defined( __cplusplus )
34 extern "C" {
35 #endif
36 
37 typedef struct libfsapfs_volume_key_bag libfsapfs_volume_key_bag_t;
38 
39 struct libfsapfs_volume_key_bag
40 {
41 	/* The entries array
42 	 */
43 	libcdata_array_t *entries_array;
44 };
45 
46 int libfsapfs_volume_key_bag_initialize(
47      libfsapfs_volume_key_bag_t **volume_key_bag,
48      libcerror_error_t **error );
49 
50 int libfsapfs_volume_key_bag_free(
51      libfsapfs_volume_key_bag_t **volume_key_bag,
52      libcerror_error_t **error );
53 
54 int libfsapfs_volume_key_bag_read_file_io_handle(
55      libfsapfs_volume_key_bag_t *volume_key_bag,
56      libfsapfs_io_handle_t *io_handle,
57      libbfio_handle_t *file_io_handle,
58      off64_t file_offset,
59      size64_t data_size,
60      const uint8_t *volume_identifier,
61      libcerror_error_t **error );
62 
63 int libfsapfs_volume_key_bag_read_data(
64      libfsapfs_volume_key_bag_t *volume_key_bag,
65      const uint8_t *data,
66      size_t data_size,
67      libcerror_error_t **error );
68 
69 int libfsapfs_volume_key_bag_get_volume_key(
70      libfsapfs_volume_key_bag_t *volume_key_bag,
71      const uint8_t *user_password,
72      size_t user_password_length,
73      const uint8_t *recovery_password,
74      size_t recovery_password_length,
75      uint8_t *key,
76      size_t key_size,
77      libcerror_error_t **error );
78 
79 #if defined( __cplusplus )
80 }
81 #endif
82 
83 #endif /* !defined( _LIBFSAPFS_VOLUME_KEY_BAG_H ) */
84 
85