Encryption

The encryption module is there to provide a low-level interface for the encryption of data and files for or within the Travis CI infrastructure.

Data

Just another Python API for Travis CI (API).

A module which provides the interface for the encryption of data for or within the Travis CI infrastructure.

Author:
Nissar Chababy, @funilrys, contactTATAfunilrysTODTODcom
Project link:
https://github.com/funilrys/PyTravisCI
Project documentation:
https://pytravisci.readthedocs.io/en/latest/

License

MIT License

Copyright (c) 2019, 2020 Nissar Chababy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
class PyTravisCI.encryption.data.DataEncryption(*, private_key: Union[str, bytes, None] = None, public_key: Union[str, bytes, None] = None)[source]

Bases: object

Provides the interface for the encryption of information for or within the Travis CI infrastructure.

Parameters:
  • private_key – The private key to use for encryption.
  • public_key – The public key to use for encryption.
decrypt_ensure_key_exists()[source]

Ensures that the key needed for encryption exists.

Raises:ValueError – When the private key is not set/given.
encrypt_ensure_key_exists()[source]

Ensures that the key needed for encryption exists.

Raises:ValueError – When the public key is not set/given.
get_private_key() → Optional[bytes][source]

Provided the currently loaded private key.

get_public_key() → Optional[bytes][source]

Provides the currently loaded public key.

set_private_key(value: Union[str, bytes], password: Union[str, bytes, None] = None) → None[source]

Sets the private key to use.

Parameters:
  • value – The private key to set.
  • password – The password associated wiht the private key (if needed).
set_public_key(value: Union[str, bytes]) → None[source]

Sets the public key to use.

Parameters:value – The public key to set.

File

Just another Python API for Travis CI (API).

A module which provides the interface for the encryption of data for or within the Travis CI infrastructure.

Author:
Nissar Chababy, @funilrys, contactTATAfunilrysTODTODcom
Project link:
https://github.com/funilrys/PyTravisCI
Project documentation:
https://pytravisci.readthedocs.io/en/latest/

License

MIT License

Copyright (c) 2019, 2020 Nissar Chababy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
class PyTravisCI.encryption.file.FileEncryption(*, key: Union[str, bytes, None] = None, iv: Union[str, bytes, None] = None)[source]

Bases: object

Provides the interface for the encryption of files for or within the Travis CI infrastructure.

Parameters:
  • key – The key to use to encrypt the file.
  • iv – The IV to use to encrypt the file.
decrypt_ensure_keys_exists()[source]

Ensures that the keys exists before any decryption.

encrypt_ensure_keys_exists()[source]

Ensures that the keys exists before any encryption.

generate_iv(*, save: bool = True) → bytes[source]

Generate a new IV key.

Parameters:save – Dis-authorize the saving into the global iv attribute.
generate_key(*, save: bool = True) → bytes[source]

Generates a new key.

Parameters:save – Dis-authorize the saving into the global key attribute.
get_iv() → Optional[bytes][source]

Provides the hexadecimal representation of the currently set iv.

get_key() → Optional[bytes][source]

Provides the hexadecimal representation of the currently set key.

set_iv(value: Union[str, bytes]) → None[source]

Sets the IV to use.

Raises:ValueError – When the size of the given key is not correct.
set_key(value: Union[str, bytes]) → None[source]

Sets the Key to use.

Raises:ValueError – When the size of the given key is not correct.