pykeystore


Namepykeystore JSON
Version 1.1.5 PyPI version JSON
download
home_pagehttps://github.com/pe2mbs/pykeystore
SummaryPython keystore
upload_time2023-01-31 20:23:20
maintainer
docs_urlNone
authorMarc Bertens-Nguyen
requires_python>=3.8
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python Keystore
This package provides a simple keystore, 

The keystore is available is three types 
* **Simple** need too supply the passphres for every secure opration
* **Exteneded** need only onetime supply the passphrase
* **Keyring** need to supply the keyring information one time, for every secure operation the passphrase is retrieved from the keyring.

All three classes have functions for account information, asymmetric keys and symmetric keys.

The keys are stored by there alias and algorithm.

There are two layers of encryption;
1.  The keystore it self.
2.  the passwords, secrets and keys.

Therefore when the keystore is loaded into memory the actual secure information is not in clear text, only the data structure it readable.

## Keystore class functions

### Simple
This atre the functions in the Keystore class

* classmethod create( filename: str, passphrase: Union[str,bytes] ) -> 'KeyStore'
* classmethod load( cls, filename: str, passphrase: Union[str,bytes] ) -> 'KeyStore'
* function save( self, filename:str, passphrase: Union[str,bytes,None] ) -> None
* function hasAccount( self, account: str ) -> bool:
* function setPassword( self, account: str, password: str, passphrase: Union[str,bytes], two_fa = None ) -> None
* function getPassword( self, account:str, passphrase: Union[str,bytes] ) -> bytes
* function get2fa( self, account:str, passphrase: Union[str,bytes] ) -> bytes
* function getAccount( self, account:str, passphrase: Union[str,bytes] ) -> tuple( account, password [, twofa ] )
* function hasPrivateKey( self, alias:str, algo:str = 'RSA' ) -> bool
* function setPrivateKey( self, alias:str, key, algo:str, passphrase: Union[str,bytes] ) -> bool
* function getPrivateKey( self, alias:str, algo:str, passphrase: Union[str,bytes] ) -> bytes
* function hasPublicKey( self, alias:str, algo:str = 'RSA' ) -> bool
* function setPublicKey( self, alias:str, key = None, algo:str = 'RSA' ) -> bool
* function getPublicKey( self, alias:str, algo:str = 'RSA' ) -> bytes
* function hasCertificate( self, alias:str, algo:str = 'RSA' ) -> bool
* function setCertificate( self, alias:str, cert, algo:str = 'RSA' ) -> bool
* function getCertificate( self, alias:str, algo:str = 'RSA' ) -> Union[bytes,None]
* function hasEncriptioneKey( self, alias:str, algo:str ) -> bool
* function setEncriptioneKey( self, alias:str, algo:str, key, passphrase: Union[str,bytes] ) -> None
* function getEncriptioneKey( self, algo:str, alias:str, passphrase: Union[str,bytes] ) -> bytes

### Extended
Most functions are the same as for the simple Keystore, the following functions differ;

* setPassword( self, account: str, password: str, two_fa = None ) -> None
* getPassword( self, account:str ) -> bytes
* get2fa( self, account:str ) -> bytes
* getAccount( self, account:str ) -> tuple
* setPrivateKey( self, alias:str, key, algo:str ) -> bool
* getPrivateKey( self, alias:str, algo:str ) -> bytes 
* setEncriptioneKey( self, alias:str, algo:str, key ) - None
* getEncriptioneKey( self, algo:str, alias: str ) -> bytes

### Keyring
Most functions are the same as for the extended/simple Keystore, the following functions differ;

* classmethod loadWithKeyring( filename, system_name, keyring_name ) -> 'KeyringKeystore'
* classmethod createWithKeyring( filename, system_name, keyring_name ) -> 'KeyringKeystore'
* saveWithKeyring( filename, system_name, keyring_name ) -> None


## Examples
### Simple
For the simple Keystore the passphrase needs to be supplied for every operation,  

    import pykeystore
    passphrase = pykeystore.create_password( '~/python-keystore-passphrase' )
    store = pykeystore.KeyStore.create( 'keystore.pykst', passphrase )
    store.setPassord( 'account@example.com', 'somepassword', passphrase, '2FA-secret' )

    password = store.getPassword( 'account@example.com', passphrase )
    twofa = store.get2fa( 'account@example.com', passphrase )

    info = store.getAccount( 'account@example.com', passphrase  )

    keystore.save( 'keystore.pykst', passphrase )

    pykeystore.KeyStore.load( 'keystore.pykst', passphrase )
    info = store.getAccount( 'account@example.com', passphrase  )


### Extended
For the exetended Keystore the passphrase needs to be supplied once, this is less secure as every thing is stored in memory at the same time.

    import pykeystore
    passphrase = pykeystore.create_password( '~/python-keystore-passphrase' )
    store = pykeystore.KeyStoreEx.create( 'keystore.pykst', passphrase )
    store.setPassord( 'account@example.com', 'somepassword', '2FA-secret' )
    
    keystore.save( 'keystore.pykst', passphrase )


### Keyring
For the keyring Keystore the system-name and username are supplied once, but the actual passphrase the retrieved seperatly for every operation.   

    import pykeystore
    
    store = pykeystore.KeyRingStore.create( 'keystore.pykst', 'systemname', 'account' )
    store.setPassord( 'account@example.com', 'somepassword', '2FA-secret' )
    
    keystore.save( 'keystore.pykst' )




            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/pe2mbs/pykeystore",
    "name": "pykeystore",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "",
    "author": "Marc Bertens-Nguyen",
    "author_email": "Marc Berten-Nguyen <m.bertens@pe2mbs.nl>",
    "download_url": "https://files.pythonhosted.org/packages/73/d5/2e4a4a735bf99af48eef71589d54102f2ea617269c1edcc56c1fcfe94f14/pykeystore-1.1.5.tar.gz",
    "platform": null,
    "description": "# Python Keystore\nThis package provides a simple keystore, \n\nThe keystore is available is three types \n* **Simple** need too supply the passphres for every secure opration\n* **Exteneded** need only onetime supply the passphrase\n* **Keyring** need to supply the keyring information one time, for every secure operation the passphrase is retrieved from the keyring.\n\nAll three classes have functions for account information, asymmetric keys and symmetric keys.\n\nThe keys are stored by there alias and algorithm.\n\nThere are two layers of encryption;\n1.  The keystore it self.\n2.  the passwords, secrets and keys.\n\nTherefore when the keystore is loaded into memory the actual secure information is not in clear text, only the data structure it readable.\n\n## Keystore class functions\n\n### Simple\nThis atre the functions in the Keystore class\n\n* classmethod create( filename: str, passphrase: Union[str,bytes] ) -> 'KeyStore'\n* classmethod load( cls, filename: str, passphrase: Union[str,bytes] ) -> 'KeyStore'\n* function save( self, filename:str, passphrase: Union[str,bytes,None] ) -> None\n* function hasAccount( self, account: str ) -> bool:\n* function setPassword( self, account: str, password: str, passphrase: Union[str,bytes], two_fa = None ) -> None\n* function getPassword( self, account:str, passphrase: Union[str,bytes] ) -> bytes\n* function get2fa( self, account:str, passphrase: Union[str,bytes] ) -> bytes\n* function getAccount( self, account:str, passphrase: Union[str,bytes] ) -> tuple( account, password [, twofa ] )\n* function hasPrivateKey( self, alias:str, algo:str = 'RSA' ) -> bool\n* function setPrivateKey( self, alias:str, key, algo:str, passphrase: Union[str,bytes] ) -> bool\n* function getPrivateKey( self, alias:str, algo:str, passphrase: Union[str,bytes] ) -> bytes\n* function hasPublicKey( self, alias:str, algo:str = 'RSA' ) -> bool\n* function setPublicKey( self, alias:str, key = None, algo:str = 'RSA' ) -> bool\n* function getPublicKey( self, alias:str, algo:str = 'RSA' ) -> bytes\n* function hasCertificate( self, alias:str, algo:str = 'RSA' ) -> bool\n* function setCertificate( self, alias:str, cert, algo:str = 'RSA' ) -> bool\n* function getCertificate( self, alias:str, algo:str = 'RSA' ) -> Union[bytes,None]\n* function hasEncriptioneKey( self, alias:str, algo:str ) -> bool\n* function setEncriptioneKey( self, alias:str, algo:str, key, passphrase: Union[str,bytes] ) -> None\n* function getEncriptioneKey( self, algo:str, alias:str, passphrase: Union[str,bytes] ) -> bytes\n\n### Extended\nMost functions are the same as for the simple Keystore, the following functions differ;\n\n* setPassword( self, account: str, password: str, two_fa = None ) -> None\n* getPassword( self, account:str ) -> bytes\n* get2fa( self, account:str ) -> bytes\n* getAccount( self, account:str ) -> tuple\n* setPrivateKey( self, alias:str, key, algo:str ) -> bool\n* getPrivateKey( self, alias:str, algo:str ) -> bytes \n* setEncriptioneKey( self, alias:str, algo:str, key ) - None\n* getEncriptioneKey( self, algo:str, alias: str ) -> bytes\n\n### Keyring\nMost functions are the same as for the extended/simple Keystore, the following functions differ;\n\n* classmethod loadWithKeyring( filename, system_name, keyring_name ) -> 'KeyringKeystore'\n* classmethod createWithKeyring( filename, system_name, keyring_name ) -> 'KeyringKeystore'\n* saveWithKeyring( filename, system_name, keyring_name ) -> None\n\n\n## Examples\n### Simple\nFor the simple Keystore the passphrase needs to be supplied for every operation,  \n\n    import pykeystore\n    passphrase = pykeystore.create_password( '~/python-keystore-passphrase' )\n    store = pykeystore.KeyStore.create( 'keystore.pykst', passphrase )\n    store.setPassord( 'account@example.com', 'somepassword', passphrase, '2FA-secret' )\n\n    password = store.getPassword( 'account@example.com', passphrase )\n    twofa = store.get2fa( 'account@example.com', passphrase )\n\n    info = store.getAccount( 'account@example.com', passphrase  )\n\n    keystore.save( 'keystore.pykst', passphrase )\n\n    pykeystore.KeyStore.load( 'keystore.pykst', passphrase )\n    info = store.getAccount( 'account@example.com', passphrase  )\n\n\n### Extended\nFor the exetended Keystore the passphrase needs to be supplied once, this is less secure as every thing is stored in memory at the same time.\n\n    import pykeystore\n    passphrase = pykeystore.create_password( '~/python-keystore-passphrase' )\n    store = pykeystore.KeyStoreEx.create( 'keystore.pykst', passphrase )\n    store.setPassord( 'account@example.com', 'somepassword', '2FA-secret' )\n    \n    keystore.save( 'keystore.pykst', passphrase )\n\n\n### Keyring\nFor the keyring Keystore the system-name and username are supplied once, but the actual passphrase the retrieved seperatly for every operation.   \n\n    import pykeystore\n    \n    store = pykeystore.KeyRingStore.create( 'keystore.pykst', 'systemname', 'account' )\n    store.setPassord( 'account@example.com', 'somepassword', '2FA-secret' )\n    \n    keystore.save( 'keystore.pykst' )\n\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Python keystore",
    "version": "1.1.5",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0b19c4620141f7a9a67d8f3698d6e98d7a9760df6e6de7c54ddb17c9fbad9e7a",
                "md5": "dc74bd63ce3f92316628e4f8b98b02d5",
                "sha256": "b0ecfdfdd8e68b7c2f4efc1ef89cdb6f7a1912a05a60ffdec6580de4e4d695a7"
            },
            "downloads": -1,
            "filename": "pykeystore-1.1.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dc74bd63ce3f92316628e4f8b98b02d5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 11909,
            "upload_time": "2023-01-31T20:23:18",
            "upload_time_iso_8601": "2023-01-31T20:23:18.969363Z",
            "url": "https://files.pythonhosted.org/packages/0b/19/c4620141f7a9a67d8f3698d6e98d7a9760df6e6de7c54ddb17c9fbad9e7a/pykeystore-1.1.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "73d52e4a4a735bf99af48eef71589d54102f2ea617269c1edcc56c1fcfe94f14",
                "md5": "ccbca5aca7ff546ffb9e772a23d0663b",
                "sha256": "7853fd71b6827c809409b642b9073a31578d841e1b64c06525ef29862891cd3d"
            },
            "downloads": -1,
            "filename": "pykeystore-1.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "ccbca5aca7ff546ffb9e772a23d0663b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 11210,
            "upload_time": "2023-01-31T20:23:20",
            "upload_time_iso_8601": "2023-01-31T20:23:20.587523Z",
            "url": "https://files.pythonhosted.org/packages/73/d5/2e4a4a735bf99af48eef71589d54102f2ea617269c1edcc56c1fcfe94f14/pykeystore-1.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-31 20:23:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "pe2mbs",
    "github_project": "pykeystore",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pykeystore"
}
        
Elapsed time: 0.08329s