🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

kabbes-cryptography

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kabbes-cryptography

Easy implementation of professional Python cryptography packages

0.1.0
Maintainers
1

GitHub Pages
PyPI

cryptography

Easy implementation of professional Python cryptography packages


Installation

pip install kabbes_cryptography


Usage

For more in-depth documentation, read the information provided on the Pages. Or better yet, read the source code.

import kabbes_cryptography as kcryp
import dir_ops as do

RSA

# Initializing RSA tokens
RSA_inst = kcryp.RSA()
RSA_inst.get_new_Keys( set = True )
RSA_inst.export_public_Key( do.Path( 'publickey' ) )
RSA_inst.export_private_Key( do.Path( 'privatekey' ) )
#Encryption with RSA
RSA_inst.encrypt( bytes('test', encoding = 'utf-8') )
print (RSA_inst.encrypted)
>>> b'nb\\\x02|:M\x82\x8a\xe1\xc7U\xfd\x1e\xc5O\xcc\x7f\x06\xc2~\xaf\x85"\ -- ETC -- '
#Decryption with RSA
dec_message = RSA_inst.decrypt()
print (dec_message.decode( 'utf-8' ))
>>> 'test'

AES

# Initializing AES
AES_inst = kcryp.AES()
AES_inst.prep_for_encrypt()
AES_inst.encrypt( bytes('test', encoding = 'utf-8') )
print (AES_inst.encrypted)
>>> b'\xd1\xf8\x0b='
dec_message = AES_inst.decrypt()
print (dec_message.decode( 'utf-8' ))
>>> 'test'

Combined

# Initializing Combined
Combined_inst = kcryp.Combined( Dir = do.Dir( do.get_cwd() ).join_Dir( path = 'CombinedEncryption' ) )
Combined_inst.RSA.import_private_Key( do.Path( 'privatekey' ), set=True )
Combined_inst.RSA.import_public_Key( do.Path( 'publickey' ), set=True )
Combined_inst.encrypt( bytes('test', encoding = 'utf-8' ) )
print (Combined_inst.encrypted)
>>> b'\xdeA\xe7\x1e'
dec_message = Combined_inst.decrypt()
print (dec_message.decode( 'utf-8 '))
>>> 'test'

Author

James Kabbes

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts