LEFT | RIGHT |
1 # -*- coding: utf-8 -*- | 1 # -*- coding: utf-8 -*- |
2 """The encrypted stream path specification implementation.""" | 2 """The encrypted stream path specification implementation.""" |
3 | 3 |
4 from __future__ import unicode_literals | 4 from __future__ import unicode_literals |
5 | 5 |
6 import codecs | 6 import codecs |
7 | 7 |
8 from dfvfs.lib import definitions | 8 from dfvfs.lib import definitions |
9 from dfvfs.path import factory | 9 from dfvfs.path import factory |
10 from dfvfs.path import path_spec | 10 from dfvfs.path import path_spec |
11 | 11 |
12 | 12 |
13 class EncryptedStreamPathSpec(path_spec.PathSpec): | 13 class EncryptedStreamPathSpec(path_spec.PathSpec): |
14 """Encrypted stream path specification. | 14 """Encrypted stream path specification. |
15 | 15 |
16 Attributes: | 16 Attributes: |
17 cipher_mode (str): cipher mode. | 17 cipher_mode (str): cipher mode. |
18 encryption_method (str): method used to the encrypt the data. | 18 encryption_method (str): method used to the encrypt the data. |
19 initialization_vector (bytes): initialization vector. | 19 initialization_vector (bytes): initialization vector. |
20 key (bytes): key. | 20 key (bytes): key. |
21 """ | 21 """ |
22 | 22 |
23 TYPE_INDICATOR = definitions.TYPE_INDICATOR_ENCRYPTED_STREAM | 23 TYPE_INDICATOR = definitions.TYPE_INDICATOR_ENCRYPTED_STREAM |
24 | 24 |
25 def __init__( | 25 def __init__( |
26 self, cipher_mode=None, encryption_method=None, | 26 self, cipher_mode=None, encryption_method=None, |
27 initialization_vector=None, key=None, parent=None, **kwargs): | 27 initialization_vector=None, key=None, parent=None, **kwargs): |
28 """Initializes the path specification. | 28 """Initializes a path specification. |
29 | 29 |
30 Note that the encrypted stream path specification must have a parent. | 30 Note that the encrypted stream path specification must have a parent. |
31 | 31 |
32 Args: | 32 Args: |
33 cipher_mode (Optional[str]): cipher mode. | 33 cipher_mode (Optional[str]): cipher mode. |
34 encryption_method (Optional[str]): method used to the encrypt the data. | 34 encryption_method (Optional[str]): method used to the encrypt the data. |
35 initialization_vector (Optional[bytes]): initialization vector. | 35 initialization_vector (Optional[bytes]): initialization vector. |
36 key (Optional[bytes]): key. | 36 key (Optional[bytes]): key. |
37 parent (Optional[PathSpec]): parent path specification. | 37 parent (Optional[PathSpec]): parent path specification. |
38 | 38 |
(...skipping 29 matching lines...) Expand all Loading... |
68 | 68 |
69 if self.key: | 69 if self.key: |
70 key = codecs.encode(self.key, 'hex') | 70 key = codecs.encode(self.key, 'hex') |
71 key = key.decode('ascii') | 71 key = key.decode('ascii') |
72 string_parts.append('key: {0:s}'.format(key)) | 72 string_parts.append('key: {0:s}'.format(key)) |
73 | 73 |
74 return self._GetComparable(sub_comparable_string=', '.join(string_parts)) | 74 return self._GetComparable(sub_comparable_string=', '.join(string_parts)) |
75 | 75 |
76 | 76 |
77 factory.Factory.RegisterPathSpec(EncryptedStreamPathSpec) | 77 factory.Factory.RegisterPathSpec(EncryptedStreamPathSpec) |
LEFT | RIGHT |