passwordcrypto


Namepasswordcrypto JSON
Version 1.0.5 PyPI version JSON
download
home_pagehttps://github.com/Muxutruk2/passwordcrypto2
SummaryA package to help make an encrypted password manager
upload_time2024-03-12 08:32:11
maintainer
docs_urlNone
authorMuxutruk
requires_python
license
keywords password cryptography security
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # passwordcrypto

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

### Installation

Execute the following command: `pip install passwordcrypto`

For windows users it's recommended to execute `pythonX.YY -m pip install passwordcrypto`

Change X.YY to the python version you use

### Initialization

```python
from passwordcrypto import passwordcrypto

# Example usage
password = bytes(input("Write your password: "))
filename = 'passwords.txt'

# Initialize a Passwd instance
password_manager = passwordcrypto.Passwd(filename, password)
```

### Reading Passwords

```python
password_entries = password_manager.read()
""" Outputs a list of passwords which themselves are a list of [App, Email, Password]
Example: [
    ['testApp', 'testEmail', 'testPassword'],
    ['testApp2','testEmail2','testPassword2'],
    ]
"""
```

### 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)
```

### Example
```python
from passwordcrypto import passwordcrypto

inputKey = bytes(input("Insert your password: ").encode())
passwodManager = passwordcrypto.Passwd("example.txt", inputKey)

while True:
    option = input("\nWhat do you want to do? (1: Read 2: Write): ")

    match option:
        case "1":
            print("\nAPP, EMAIL, PASSWORD")
            passwordList = passwodManager.read()
            for line in passwordList:
                print(", ".join(line))

        case "2":
            app = input("Insert app name: ")
            email = input("Insert email/username: ")
            password = input("Insert password: ")
            passwodManager.write(app,email,password)

        case _:
            exit()
```

## 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

The password used to create the instances of Passwd should not be stored anywhere, instead inputted by the user.

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/passwordcrypto2",
    "name": "passwordcrypto",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "password,cryptography,security",
    "author": "Muxutruk",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/b7/8b/982288b39eea4276164769f6ef48544a2385d0c7a46925e83eedd079251b/passwordcrypto-1.0.5.tar.gz",
    "platform": null,
    "description": "# passwordcrypto\n\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.\n\n## Usage\n\n### Installation\n\nExecute the following command: `pip install passwordcrypto`\n\nFor windows users it's recommended to execute `pythonX.YY -m pip install passwordcrypto`\n\nChange X.YY to the python version you use\n\n### Initialization\n\n```python\nfrom passwordcrypto import passwordcrypto\n\n# Example usage\npassword = bytes(input(\"Write your password: \"))\nfilename = 'passwords.txt'\n\n# Initialize a Passwd instance\npassword_manager = passwordcrypto.Passwd(filename, password)\n```\n\n### Reading Passwords\n\n```python\npassword_entries = password_manager.read()\n\"\"\" Outputs a list of passwords which themselves are a list of [App, Email, Password]\nExample: [\n    ['testApp', 'testEmail', 'testPassword'],\n    ['testApp2','testEmail2','testPassword2'],\n    ]\n\"\"\"\n```\n\n### Writing Passwords\n\n```python\n# Write a new password entry to the file\napp_name = 'MyApp'\nemail_address = 'user@example.com'\nuser_password = 'SecurePassword123'\n\npassword_manager.write(app_name, email_address, user_password)\n```\n\n### Example\n```python\nfrom passwordcrypto import passwordcrypto\n\ninputKey = bytes(input(\"Insert your password: \").encode())\npasswodManager = passwordcrypto.Passwd(\"example.txt\", inputKey)\n\nwhile True:\n    option = input(\"\\nWhat do you want to do? (1: Read 2: Write): \")\n\n    match option:\n        case \"1\":\n            print(\"\\nAPP, EMAIL, PASSWORD\")\n            passwordList = passwodManager.read()\n            for line in passwordList:\n                print(\", \".join(line))\n\n        case \"2\":\n            app = input(\"Insert app name: \")\n            email = input(\"Insert email/username: \")\n            password = input(\"Insert password: \")\n            passwodManager.write(app,email,password)\n\n        case _:\n            exit()\n```\n\n## API Reference\n\n### `generate_key_from_password(password: bytes) -> Fernet`\n\nGenerates a Fernet key derived from the provided password.\n\n### `class Passwd(filename: str, key: bytes) -> None`\n\nInitialize a Passwd instance.\n\n- `filename (str)`: The name of the file to store encrypted passwords.\n- `key (bytes)`: The Fernet key used for encryption and decryption.\n\n### `getEncryptedPasswds() -> list[bytes]`\n\nRetrieve encrypted passwords from the file.\n\n### `read() -> list[list[str]]`\n\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]`.\n\n### `encrypt(text: str) -> bytes`\n\nEncrypt the given text using the Fernet key.\n\n- `text (str)`: The text to be encrypted.\n\n### `write(app: str, email: str, password: str) -> None`\n\nEncrypt and write a new password entry to the file.\n\n- `app (str)`: The application or service name.\n- `email (str)`: The associated email address.\n- `password (str)`: The password for the application or service.\n\n## Security Note\n\nThe password used to create the instances of Passwd should not be stored anywhere, instead inputted by the user.\n\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.\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A package to help make an encrypted password manager",
    "version": "1.0.5",
    "project_urls": {
        "Homepage": "https://github.com/Muxutruk2/passwordcrypto2"
    },
    "split_keywords": [
        "password",
        "cryptography",
        "security"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e179f5c8e14183812af59aec6e3236449162e6dcefbccbaa179cf28ec8075a2f",
                "md5": "ad4f12b2cc55ad705737a4694b952b46",
                "sha256": "86681f6ddb2e2caf87bac60931ee0bb553f3a9abdff238cbc1e7e1442720cc7c"
            },
            "downloads": -1,
            "filename": "passwordcrypto-1.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ad4f12b2cc55ad705737a4694b952b46",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 5690,
            "upload_time": "2024-03-12T08:32:10",
            "upload_time_iso_8601": "2024-03-12T08:32:10.663790Z",
            "url": "https://files.pythonhosted.org/packages/e1/79/f5c8e14183812af59aec6e3236449162e6dcefbccbaa179cf28ec8075a2f/passwordcrypto-1.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b78b982288b39eea4276164769f6ef48544a2385d0c7a46925e83eedd079251b",
                "md5": "2558ffbbf6b5cfdc167eceab86cf4eb2",
                "sha256": "c545e94f9742e5afda9ed2994623c4ec65e4dc4ef9cb3735d47f9e5bb3de4c34"
            },
            "downloads": -1,
            "filename": "passwordcrypto-1.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "2558ffbbf6b5cfdc167eceab86cf4eb2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4762,
            "upload_time": "2024-03-12T08:32:11",
            "upload_time_iso_8601": "2024-03-12T08:32:11.702138Z",
            "url": "https://files.pythonhosted.org/packages/b7/8b/982288b39eea4276164769f6ef48544a2385d0c7a46925e83eedd079251b/passwordcrypto-1.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-12 08:32:11",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Muxutruk2",
    "github_project": "passwordcrypto2",
    "github_not_found": true,
    "lcname": "passwordcrypto"
}
        
Elapsed time: 0.23639s