varbin / python-camellia Goto Github PK
View Code? Open in Web Editor NEWPEP-compliant Camellia encryption Library for python
License: Other
PEP-compliant Camellia encryption Library for python
License: Other
Currently trying to decrypt cipher text from WolfSSL implementation. Your implementation is having trouble decrypting despite both you and WolfSSL using the Nippon encrypt and decrypt source code for Camellia.
import camellia
key = b'SzE6pcNdUGbF0nVTNjqDj79v8JwBf7P2'
iv = b'\xd7\xfe3\x1d\x10\x85&^\xe6\x12p\xf8GZ\xb2\xa4'
salt = 'b\xc41\xa6\x8d\xa1b\x00'
cipher_text = b'\xb5\x7f\xbdpkkF\xef1\xbfX\xaf\x94\xf0\xec|V\xe4\xa8\xbe\x1a0B\xa8\x04Aq\x84\xd4\xa6M\xf8\x13\x9e<=\xbd\x1cbD\xdd\x82\xbe\\\x94\xf4m('
new_key = hashlib.pbkdf2_hmac('sha256', key, salt, 4096)
c2 = camellia.CamelliaCipher(key=key, IV=bytes(iv), mode=camellia.MODE_CBC)
print("decrypt >>>> ", c2.decrypt(encrypted).decode() )
This should decrypt to "Hello there, you decrypted the string"
Make code PEP 272 compliant (API for Block Encryption Algorithms v1.0).
Current status:
Sources:
The code checks for the camellia dll of your current architecture. However, it gets the architecture of the system, not the architecture of the currently running Python. When using 32 bit Python it tries to open camellia-win32-AMD64-WindowsPE.dll
, which fails.
https://github.com/Varbin/python-camellia/blob/master/src/camellia/__init__.py#L192-L199
It appears self.counter is called twice (not once) for each block - once to check the length, another to actually decrypt. Should the second instance be ctr
instead of self.counter()
?
Hi,
When I use CBC mode, it works but when I use CTR as follows:
camellia.CamelliaCipher(key=b'16 byte long key', IV=b'16 byte iv. abcd', mode=camellia.MODE_CTR)
I get the following error:
NotImplementedError: This mode is not supported!
Could you help me with this, please!
Possible solutions are:
=> All solutions will drop IronPython and Jython support. Proper .NET or Java libraries should be used in Jython/IronPython.
Currently, python-camellia uses the official reference implementation. This is not optimized in any way. The official statement (by the camellia authors) is:
This reference code is written for an easy understanding of the Camellia
encryption algorithm and a tool for validity verification of a source code that you made.
It is not intended to be used for a specific application.
No optimized techniques are adopted at all in this code.
In future versions,
Crypto engine for Camellia (C
[mini], BSD License)
will be used.
Current Status:
Sources:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.