passwd-crypto


Namepasswd-crypto JSON
Version 0.1 PyPI version JSON
download
home_pagehttps://github.com/Muxutruk2/passwd-crypto
SummaryPassword manager with Fernet encryption
upload_time2024-03-09 18:09:53
maintainer
docs_urlNone
authorMuxutruk
requires_python
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # passwd-crypto

This Python module provides a simple password manager for securely storing and retrieving encrypted password entries. The passwords are encrypted using the Fernet symmetric encryption scheme. The module includes functionality to derive a Fernet key from a password, initialize a password manager instance, retrieve encrypted passwords, decrypt and read stored passwords, encrypt text, and write new password entries to a file.

## Usage

### Initialization

```python
from passwd-crypto import Passwd, generate_key_from_password

# Example usage
password = b'MyStrongPassword'
key = generate_key_from_password(password)
filename = 'passwords.txt'

# Initialize a Passwd instance
password_manager = Passwd(filename, key)
```

### Reading Passwords

```python
# Retrieve encrypted passwords from the file
encrypted_passwords = password_manager.getEncryptedPasswds()

# Decrypt and read stored passwords
password_entries = password_manager.read()
```

### Writing Passwords

```python
# Write a new password entry to the file
app_name = 'MyApp'
email_address = 'user@example.com'
user_password = 'SecurePassword123'

password_manager.write(app_name, email_address, user_password)
```

## API Reference

### `generate_key_from_password(password: bytes) -> Fernet`

Generates a Fernet key derived from the provided password.

### `class Passwd(filename: str, key: bytes) -> None`

Initialize a Passwd instance.

- `filename (str)`: The name of the file to store encrypted passwords.
- `key (bytes)`: The Fernet key used for encryption and decryption.

### `getEncryptedPasswds() -> list[bytes]`

Retrieve encrypted passwords from the file.

### `read() -> list[list[str]]`

Decrypt and read stored passwords from the file. Returns a list of decrypted password entries, where each entry is a list with the format `[App, Email, Password]`.

### `encrypt(text: str) -> bytes`

Encrypt the given text using the Fernet key.

- `text (str)`: The text to be encrypted.

### `write(app: str, email: str, password: str) -> None`

Encrypt and write a new password entry to the file.

- `app (str)`: The application or service name.
- `email (str)`: The associated email address.
- `password (str)`: The password for the application or service.

## Security Note

Adjust the number of iterations in the key derivation process (`iterations` parameter in `generate_key_from_password`) based on your security requirements. Higher iterations increase security but also result in longer key derivation times.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Muxutruk2/passwd-crypto",
    "name": "passwd-crypto",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Muxutruk",
    "author_email": "musutruk.music+passwd@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/0f/cf/8178db0b6bacc558cee0cce2ff12a2c63e39faef61cd9c7d40b74de21263/passwd-crypto-0.1.tar.gz",
    "platform": null,
    "description": "# passwd-crypto\r\n\r\nThis Python module provides a simple password manager for securely storing and retrieving encrypted password entries. The passwords are encrypted using the Fernet symmetric encryption scheme. The module includes functionality to derive a Fernet key from a password, initialize a password manager instance, retrieve encrypted passwords, decrypt and read stored passwords, encrypt text, and write new password entries to a file.\r\n\r\n## Usage\r\n\r\n### Initialization\r\n\r\n```python\r\nfrom passwd-crypto import Passwd, generate_key_from_password\r\n\r\n# Example usage\r\npassword = b'MyStrongPassword'\r\nkey = generate_key_from_password(password)\r\nfilename = 'passwords.txt'\r\n\r\n# Initialize a Passwd instance\r\npassword_manager = Passwd(filename, key)\r\n```\r\n\r\n### Reading Passwords\r\n\r\n```python\r\n# Retrieve encrypted passwords from the file\r\nencrypted_passwords = password_manager.getEncryptedPasswds()\r\n\r\n# Decrypt and read stored passwords\r\npassword_entries = password_manager.read()\r\n```\r\n\r\n### Writing Passwords\r\n\r\n```python\r\n# Write a new password entry to the file\r\napp_name = 'MyApp'\r\nemail_address = 'user@example.com'\r\nuser_password = 'SecurePassword123'\r\n\r\npassword_manager.write(app_name, email_address, user_password)\r\n```\r\n\r\n## API Reference\r\n\r\n### `generate_key_from_password(password: bytes) -> Fernet`\r\n\r\nGenerates a Fernet key derived from the provided password.\r\n\r\n### `class Passwd(filename: str, key: bytes) -> None`\r\n\r\nInitialize a Passwd instance.\r\n\r\n- `filename (str)`: The name of the file to store encrypted passwords.\r\n- `key (bytes)`: The Fernet key used for encryption and decryption.\r\n\r\n### `getEncryptedPasswds() -> list[bytes]`\r\n\r\nRetrieve encrypted passwords from the file.\r\n\r\n### `read() -> list[list[str]]`\r\n\r\nDecrypt and read stored passwords from the file. Returns a list of decrypted password entries, where each entry is a list with the format `[App, Email, Password]`.\r\n\r\n### `encrypt(text: str) -> bytes`\r\n\r\nEncrypt the given text using the Fernet key.\r\n\r\n- `text (str)`: The text to be encrypted.\r\n\r\n### `write(app: str, email: str, password: str) -> None`\r\n\r\nEncrypt and write a new password entry to the file.\r\n\r\n- `app (str)`: The application or service name.\r\n- `email (str)`: The associated email address.\r\n- `password (str)`: The password for the application or service.\r\n\r\n## Security Note\r\n\r\nAdjust the number of iterations in the key derivation process (`iterations` parameter in `generate_key_from_password`) based on your security requirements. Higher iterations increase security but also result in longer key derivation times.\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Password manager with Fernet encryption",
    "version": "0.1",
    "project_urls": {
        "Homepage": "https://github.com/Muxutruk2/passwd-crypto"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c7e9ea42bcfffb81b8cd297edaafef1572cd5b7e4b1a9cddca474bc328cfd0bb",
                "md5": "8e50725053e61e12ab8ba26279e4d4a9",
                "sha256": "8114a922691505aca61e456ac7a93e3cd3d873b2a8b09b4c0669cd51bf2649be"
            },
            "downloads": -1,
            "filename": "passwd_crypto-0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8e50725053e61e12ab8ba26279e4d4a9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 2934,
            "upload_time": "2024-03-09T18:09:51",
            "upload_time_iso_8601": "2024-03-09T18:09:51.631537Z",
            "url": "https://files.pythonhosted.org/packages/c7/e9/ea42bcfffb81b8cd297edaafef1572cd5b7e4b1a9cddca474bc328cfd0bb/passwd_crypto-0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0fcf8178db0b6bacc558cee0cce2ff12a2c63e39faef61cd9c7d40b74de21263",
                "md5": "e9483782be97a1356637fca5406abe7c",
                "sha256": "e4ed4dfe3f5126f91e218b25f100b7d7f49f2039d798861550fc607852651635"
            },
            "downloads": -1,
            "filename": "passwd-crypto-0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "e9483782be97a1356637fca5406abe7c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 2954,
            "upload_time": "2024-03-09T18:09:53",
            "upload_time_iso_8601": "2024-03-09T18:09:53.419735Z",
            "url": "https://files.pythonhosted.org/packages/0f/cf/8178db0b6bacc558cee0cce2ff12a2c63e39faef61cd9c7d40b74de21263/passwd-crypto-0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-09 18:09:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Muxutruk2",
    "github_project": "passwd-crypto",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "passwd-crypto"
}
        
Elapsed time: 0.18352s