# \[ANN\] ToyPublicKeys.jl - Public key cryptography

**URL:** https://discourse.julialang.org/t/ann-toypublickeys-jl-public-key-cryptography/125239
**Category:** Package Announcements
**Tags:** package, announcement
**Created:** [January 26, 2025, 8:33pm UTC](https://discourse.julialang.org/t/ann-toypublickeys-jl-public-key-cryptography/125239 "2025-01-26T20:33:16Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![NegaScout](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/negascout/32/214936_2.png) [@NegaScout](https://discourse.julialang.org/u/NegaScout)
#### Post date: [January 26, 2025, 8:33pm UTC](https://discourse.julialang.org/t/ann-toypublickeys-jl-public-key-cryptography/125239/1 "2025-01-26T20:33:16Z")

</div>

Hello everyone! I’m happy to announce the first registered version of **ToyPublicKeys** , a mostly\* Julia-native implementation of public-key cryptographic protocols\*\*.

Public key cryptography is a key pillar of the modern internet, ensuring anonymity, integrity, key exchange and authentication. **ToyPublicKeys** aims to serve as a playground and educational resource for anyone curious about cryptography in Julia. It’s not meant to be production-ready but rather a starting point to spark more interest in the community.

Contributions—be it implementation, documentation, or auditing—are very much welcome! 🙂

\* BigInt from Julia base is binding to libGMP  
\*\* So far only RSA is implemented, but Diffie-Helman, ElGamal and the rest of the mainstream cryptosystems are planned 🙂

---

<div class="post-metadata">

### Author: ![Janis\_Erdmanis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/janis_erdmanis/32/10869_2.png) [@Janis\_Erdmanis](https://discourse.julialang.org/u/Janis_Erdmanis)
#### Post date: [January 27, 2025, 12:03am UTC](https://discourse.julialang.org/t/ann-toypublickeys-jl-public-key-cryptography/125239/2 "2025-01-27T00:03:27Z")

</div>

Looks very interesting 🥳. I did not know of a few of the GMP methods one could use in the context of cryptography and I may take a note here. The goal of exploring the different ways one can implement public key cryptography and expose it via APIs is quite useful as users can have different preferences and RSA space is particularly unexplored.

You may also be interested in CryptoGroups.jl, which focuses only on discrete logarithm-based cryptography. As I identified when doing benchmarks for ShuffleProofs.jl, it would benefit from implementing Montgomery arithmetic for modular prime groups and rewriting of elliptic curve implementations for performance.

---

<div class="post-metadata">

### Author: ![NegaScout](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/negascout/32/214936_2.png) [@NegaScout](https://discourse.julialang.org/u/NegaScout)
#### Post date: [January 27, 2025, 10:27pm UTC](https://discourse.julialang.org/t/ann-toypublickeys-jl-public-key-cryptography/125239/3 "2025-01-27T22:27:23Z")

</div>

Yes, I think I will likely use CryptoGroups.jl for eliptic stuff as it looks very solid. However, some libGMP functionality is not binded and Julia maintainers do not want to widen support for more the BigInt functionality. [It was proposed](https://github.com/JuliaLang/julia/pull/56903#issuecomment-2568202061), to bind it in dedicated package. I am not familiar with the Julia/C memory layout differences as of now, but I might try.

It seems to me, that maybe it could free up some of your util code in CryptoGroups.jl? As of now, I want/need more GMP in ToyPublicKeys as well

---

<div class="post-metadata">

### Author: ![Janis\_Erdmanis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/janis_erdmanis/32/10869_2.png) [@Janis\_Erdmanis](https://discourse.julialang.org/u/Janis_Erdmanis)
#### Post date: [January 27, 2025, 11:05pm UTC](https://discourse.julialang.org/t/ann-toypublickeys-jl-public-key-cryptography/125239/4 "2025-01-27T23:05:29Z")

</div>

> [@NegaScout](#):
>
> It seems to me, that maybe it could free up some of your util code in [CryptoGroups.jl](https://juliaregistries.github.io/General/packages/redirect_to_repo/CryptoGroups)? As of now, I want/need more GMP in ToyPublicKeys as well

I think a seperate GMP library that exposes common functionality used in cryptography may be a good idea. In `Util.jl` I have optimized `int2octet` and `octet2int` functions and a `jacobi` functions that is optimized for `BigInt` which I could contribute.

The name of the package could be something like `CryptoGMP`, `GMPUtils` or something like that would allow it to be easy found on the registry.

---

<div class="post-metadata">

### Author: ![sgaure](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sgaure/32/14779_2.png) [@sgaure](https://discourse.julialang.org/u/sgaure)
#### Post date: [January 28, 2025, 8:31am UTC](https://discourse.julialang.org/t/ann-toypublickeys-jl-public-key-cryptography/125239/5 "2025-01-28T08:31:20Z")

</div>

Note that the algorithms based on Diffie-Hellman, RSA, elliptic curves etc. are being phased out. NIST has standardized new ones which presumably are more resistant to quantum computers.

> **[NIST Releases First 3 Finalized Post-Quantum Encryption Standards](https://www.nist.gov/news-events/news/2024/08/nist-releases-first-3-finalized-post-quantum-encryption-standards)**
>
> NIST is encouraging computer system administrators to begin transitioning to the new standards as soon as possible

---

<div class="post-metadata">

### Author: ![NegaScout](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/negascout/32/214936_2.png) [@NegaScout](https://discourse.julialang.org/u/NegaScout)
#### Post date: [January 28, 2025, 10:59am UTC](https://discourse.julialang.org/t/ann-toypublickeys-jl-public-key-cryptography/125239/6 "2025-01-28T10:59:53Z")

</div>

I am aware of the LWE based crypto that NIST is proposing. However, I am not yet fully familiar with the math behind it. But it is on my mind and will be hopefully some day implemented
