Giter Site home page Giter Site logo

capeprivacy / hybrid-pke Goto Github PK

View Code? Open in Web Editor NEW
9.0 8.0 0.0 1.7 MB

The Hybrid Public Key Encryption (HPKE) standard in Python

License: Apache License 2.0

Python 40.35% Rust 57.53% Makefile 2.13%
cryptography encryption hpke public-key-encryption authenticated-encryption symmetric-encryption

hybrid-pke's People

Contributors

jvmncs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hybrid-pke's Issues

Wheel installation failing on 64-bit Windows

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'

investigate building hpke-rs without std

in version 0.2.0, a bunch of work was done on hpke-rs to make it no-std compatible. taking advantage of this work could reduce the size of the cdylib hybrid-pke relies on

Decapsulate a encapped key from a ciphertext

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.