capeprivacy / hybrid-pke Goto Github PK
View Code? Open in Web Editor NEWThe Hybrid Public Key Encryption (HPKE) standard in Python
License: Apache License 2.0
The Hybrid Public Key Encryption (HPKE) standard in Python
License: Apache License 2.0
On windows we are seeing the PyPI wheel failing to install, forcing pip to fall back to building from source:
Collecting hybrid-pke
Downloading hybrid_pke-1.0.0.tar.gz (1.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.7/1.7 MB 10.1 MB/s eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... error
error: subprocess-exited-with-error
× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Cargo, the Rust package manager, is not installed or is not on PATH.
This package requires Rust and Cargo to compile extensions. Install it through
the system's package manager or via https://rustup.rs/
Checking for Rust toolchain....
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
Windows arch:
>>> import platform
>>> platform.architecture()
('64bit', 'WindowsPE')
>>> platform.platform()
'Windows-10-10.0.22621-SP0'
Per the following issues, there is a problem with PyO3's pyfunction
macro triggering a faulty warning in clippy:
In #21 we force allow-ed the faulty warning. The PyO3 PR merges a fix, but it has not yet made it's way into a release. Once a new version of PyO3 has been published, we should revert the lint change we did in #21 by dis-allowing the lint warning for borrow_deref_ref
.
Hi,
I have cypher texts with an encapsulated symmetric key (send by third party). Is it possible to decapsulate these keys using the private key? I think rust-hpke can.
I asked the question on chat gpt which came up with the code below, but the HypridPKE class it is talking about, does not exist in 1.0.1 of hybrid-pke.
from hybrid_pke import HybridPKE, HybridError
# Initialize the HybridPKE object
hybrid_pke = HybridPKE()
# Generate a key pair
private_key, public_key = hybrid_pke.generate_key_pair()
# Encrypt a message
message = b"Hello, world!"
ciphertext, encapped_key = hybrid_pke.encrypt(public_key, message)
# Decapsulate the encapped key
decapsulated_key = hybrid_pke.decapsulate(private_key, encapped_key)
# Decrypt the ciphertext using the decapsulated key
try:
decrypted_message = hybrid_pke.decrypt(private_key, ciphertext, decapsulated_key)
print(decrypted_message)
except HybridError as e:
print(e)
Currently, the HpkeCrypto implementation is fixed to Rust Crypto (e.g. here). It would be better if we could make this configurable (at least when building from source)
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.