@@ -46,11 +46,12 @@ The Encryption class
4646
4747.. class :: Encryption
4848
49- .. attribute :: id
49+ .. autoattribute :: id
5050
5151 Optional identifier of the encryption key.
5252
5353 .. attribute :: algorithm
54+ :type: str | None
5455
5556 A URI of the encryption algorithm used. See the section
5657 :ref: `encryption-algorithms ` below for a list of algorithms URIs.
@@ -62,22 +63,24 @@ The Encryption class
6263
6364
6465 .. attribute :: is_encrypted
66+ :type: bool
6567
6668 An indicator of whether the PSKC file requires an additional pre-shared
6769 key or passphrase to decrypt the contents of the file. Will be ``True ``
6870 if a key or passphrase is needed, ``False `` otherwise.
6971
70- .. attribute :: key_names
72+ .. autoattribute :: key_names
7173
7274 List of names provided for the encryption key.
7375
7476 .. attribute :: key_name
77+ :type: str | None
7578
7679 Since usually only one name is defined for a key but the schema allows
7780 for multiple names, this is a shortcut for accessing the first value of
7881 :attr: `key_names `. It will return ``None `` if no name is available.
7982
80- .. attribute :: key
83+ .. autoattribute :: key
8184
8285 The binary value of the encryption key. In the case of pre-shared keys
8386 this value should be set before trying to access encrypted information
@@ -86,75 +89,20 @@ The Encryption class
8689 When using key derivation the secret key is available in this attribute
8790 after calling :func: `derive_key `.
8891
89- .. function :: derive_key(password)
92+ .. automethod :: derive_key
9093
91- Derive a key from the supplied password and information in the PSKC
92- file (generally algorithm, salt, etc.).
93-
94- This function may raise a :exc: `~pskc.exceptions.KeyDerivationError `
95- exception if key derivation fails for some reason.
96-
97- .. attribute :: fields
94+ .. autoattribute :: fields
9895
9996 A list of :class: `~pskc.key.Key ` instance field names that will be
10097 encrypted when the PSKC file is written. List values can contain
10198 ``secret ``, ``counter ``, ``time_offset ``, ``time_interval `` and
10299 ``time_drift ``.
103100
104- .. function :: setup_preshared_key(...)
105-
106- Configure pre-shared key encryption when writing the file.
107-
108- :param bytes key: the encryption key to use
109- :param str id: encryption key identifier
110- :param str algorithm: encryption algorithm
111- :param int key_length: encryption key length in bytes
112- :param str key_name: a name for the key
113- :param list key_names: a number of names for the key
114- :param list fields: a list of fields to encrypt
115-
116- This is a utility function to easily set up encryption. Encryption can
117- also be set up by manually by setting the
118- :class: `~pskc.encryption.Encryption ` properties.
119-
120- This method will generate a key if required and set the passed values.
121- By default AES128-CBC encryption will be configured and unless a key is
122- specified one of the correct length will be generated. If the algorithm
123- does not provide integrity checks (e.g. CBC-mode algorithms) integrity
124- checking in the PSKC file will be set up using
125- :func: `~pskc.mac.MAC.setup() `.
126-
127- By default only the :attr: `~pskc.key.Key.secret ` property will be
128- encrypted when writing the file.
129-
130- .. function :: setup_pbkdf2(...)
131-
132- Configure password-based PSKC encryption when writing the file.
133-
134- :param str password: the password to use (required)
135- :param str id: encryption key identifier
136- :param str algorithm: encryption algorithm
137- :param int key_length: encryption key length in bytes
138- :param str key_name: a name for the key
139- :param list key_names: a number of names for the key
140- :param list fields: a list of fields to encrypt
141- :param bytes salt: PBKDF2 salt
142- :param int salt_length: used when generating random salt
143- :param int iterations: number of PBKDF2 iterations
144- :param function prf: PBKDF2 pseudorandom function
145-
146- Defaults for the above parameters are similar to those for
147- :func: `setup_preshared_key() ` but the password parameter is required.
148-
149- By default 12000 iterations will be used and a random salt with the
150- length of the to-be-generated encryption key will be used.
101+ .. automethod :: setup_preshared_key
151102
152- .. function :: remove_encryption()
103+ .. automethod :: setup_pbkdf2
153104
154- Decrypt all data stored in the PSKC file and remove the encryption
155- configuration. This can be used to read and encrypted PSKC file,
156- decrypt the file, remove the encryption and output an unencrypted PSKC
157- file or to replace the encryption algorithm.
105+ .. automethod :: remove_encryption
158106
159107
160108.. _encryption-algorithms :
0 commit comments