Skip to content

Commit 44ebff8

Browse files
author
Janis Erdmanis
committed
prep for release
1 parent 3377e9b commit 44ebff8

File tree

6 files changed

+20
-29
lines changed

6 files changed

+20
-29
lines changed
File renamed without changes.
File renamed without changes.

README.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# CryptoGroups Overview
1+
# CryptoGroups.jl
22

33
[![codecov](https://codecov.io/gh/PeaceFounder/CryptoGroups.jl/graph/badge.svg?token=G9HT9VSV4T)](https://codecov.io/gh/PeaceFounder/CryptoGroups.jl)
44
[![](https://img.shields.io/badge/docs-dev-blue.svg)](https://PeaceFounder.github.io/CryptoGroups.jl/dev)
55

6-
CryptoGroups is a Julia package that provides a flexible and type-safe implementation of cryptographic groups. It offers a unified interface for working with various types of groups, including modular prime groups and elliptic curves over prime and binary fields.
6+
CryptoGroups is a Julia package that provides a versatile and type-safe implementation of cryptographic groups. It offers a unified interface for working with various types of groups, including modular prime groups and elliptic curves over prime and binary fields. Blending educational value with production-ready capabilities, CryptoGroups serves both beginners and seasoned practitioners, as evidenced by its successful integration in projects like [CryptoSignatures](https://github.com/PeaceFounder/CryptoSignatures.jl) and [ShuffleProofs](https://github.com/PeaceFounder/ShuffleProofs.jl).
77

88
## Key Features
99

@@ -77,14 +77,16 @@ CryptoGroups is a Julia package that provides a flexible and type-safe implement
7777
g == G(octet(g)) == G(value(g))
7878
```
7979

80-
## Safety Considerations
80+
## Safety Guarantees
8181

82-
- Group element arithmetics is possible only with the same types of groups and throws `MethodError` when that is violated. For instance, `@ECGroup{P_192}() * @ECGroup{P_256}()` throws an error.
83-
- Group elements are validated during construction, throwing `ArgumentError` for invalid inputs.
84-
- Moduler prime group elements are checked to belong in prime group via $g^q = 1$.
85-
- Elliptic curve points are checked for curve equation satisfaction and cofactor validation.
86-
- The package implements checks to prevent issues with special cases in point addition formulas.
87-
- Exponentiation with $k \mod q = 0$ shows warning or throws an error in a strict mode.
82+
While no cryptographic system can guarantee absolute security, CryptoGroups implements the following safety features:
83+
84+
- Group element arithmetics is possible only with the same types of groups and throws `MethodError` when that is violated. For instance, `@ECGroup{P_192}() * @ECGroup{P_256}()` throws an error;
85+
- Group elements are validated during construction, throwing `ArgumentError` for invalid inputs;
86+
- Modular prime group elements are checked to belong in prime group via $g^q = 1$;
87+
- Elliptic curve points are checked for curve equation satisfaction and cofactor validation;
88+
- The package implements checks to prevent issues with special cases in point addition formulas;
89+
- Exponentiation with $k~ {\rm mod} ~q = 0$ shows warning or throws an error in a strict mode.
8890

8991
## Limitations and Future Work
9092

@@ -95,7 +97,7 @@ The current implementation of CryptoGroups has several areas where performance o
9597
- The package doesn't use projective coordinates for elliptic curve arithmetics;
9698
- Lacks special treatment for Koblitz curves;
9799
- Doesn't implement Mersenne primes when available over generic prime fields;
98-
- Binary field operations, the current implementation is suboptimal and doesn't take advantage of hardware-provided carryless operations;
100+
- Binary field operations, the current implementation is suboptimal and doesn't take advantage of hardware-provided carryless operations.
99101

100102
These limitations result in significantly slower performance compared to state-of-the-art implementations. Preliminary estimates suggest that operations on prime curves in CryptoGroups are about 100 times slower than optimized libraries like OpenSSL, while binary curves may be up to 1000 times slower.
101103

@@ -109,8 +111,11 @@ Despite these limitations, CryptoGroups provides a solid foundation for cryptogr
109111

110112
# References
111113

114+
- [elliptic-curve](https://github.com/sdiehl/elliptic-curve#readme) library in Haskell which share similar goals
112115
- [RFC2409](https://tools.ietf.org/html/rfc2409#section-6.2) and [RFC5114](https://tools.ietf.org/html/rfc5114#section-2.1) for modular prime group constants
113116
- [SafeCurves](https://safecurves.cr.yp.to/complete.html) on addition checks for Weierstrass curves
114117
- [FIPS 186-4](https://csrc.nist.gov/pubs/fips/186-4/final) and [FIPS 186-5](https://csrc.nist.gov/pubs/fips/186-5/final)
115118
- [NIST SP 800-186](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-186-draft.pdf)
116119
- [ANSI X9.142](https://webstore.ansi.org/preview-pages/ASCX9/preview_ANSI+X9.142-2020.pdf) and in unpaywalled form [here](https://www.cs.miami.edu/home/burt/learning/Csc609.142/ecdsa-cert.pdf)
120+
- [CryptoSignatures.jl](https://github.com/PeaceFounder/CryptoSignatures.jl) FIPS 186-4 digital signature algorithm implemetation
121+
- [ShuffleProofs.jl](https://github.com/PeaceFounder/ShuffleProofs.jl) Verificatum compatable ElGamal proof of shuffle implementation

docs/make.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ makedocs(
5151
modules = [CryptoGroups, CryptoGroups.Fields, CryptoGroups.Curves, CryptoGroups.Utils],
5252
warnonly = true,
5353
pages = [
54-
"index.md",
54+
"Overview" => "index.md",
5555
"Group Examples" => [
5656
"Digital Signature Algorithm" => include_example("dsa.jl"),
5757
"Key Encapsulation Mechanism" => include_example("kem.jl"),

src/Fields/abstract_fields.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ octet(x::PrimeField) = int2octet(value(x), bitlength(modulus(x)))
213213
Converts field value to an octet and then to integer from which remainder is computed. This is in accord with FIPS 186-4
214214
standart for making ECDSA signatures over binary fields.
215215
"""
216-
Base.rem(x::BinaryField, q::Integer) = rem(octet(x) |> Utils.octet2int, q) # used in ec2n.jl test in CryptoSignatures
216+
Base.rem(x::BinaryField, q::Integer) = rem(octet(x) |> octet2int, q) # used in ec2n.jl test in CryptoSignatures
217217

218218
"""
219219
rem(x::PrimeField, q::T)::T where T <: Integer

src/spec.jl

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ concretize_type(::Type{Weierstrass}, a::Integer, b::Integer) = Weierstrass{stati
1717
concretize_type(::Type{Weierstrass}, a::BitVector, b::BitVector) = Weierstrass{StaticBitVector(a), StaticBitVector(b)}
1818
concretize_type(::Type{Weierstrass}, a::F, b::F) where F <: BinaryField = concretize_type(Weierstrass, tobits(a), tobits(b))
1919

20+
concretize_type(::Type{P}, curve::Koblitz) where P <: AbstractPoint = concretize_type(P, curve.bec)
21+
concretize_type(::Type{ECPoint{P}}, curve::Koblitz; name = name(curve)) where P <: AbstractPoint = concretize_type(ECPoint{P}, curve.bec; name)
2022

2123
function concretize_type(::Type{ECPoint{P}}, curve::GroupSpec; name = name(curve)) where P <: AbstractPoint
2224

@@ -32,23 +34,7 @@ end
3234

3335
concretize_type(::Type{ECPoint}, spec::GroupSpec; name = name(spec)) = concretize_type(ECPoint{AffinePoint}, spec; name)
3436

35-
36-
function concretize_type(::Type{F2GNB}, N::Int)
37-
38-
div(N, 8) != 0 || throw(ArgumentError("Out of X9.62 spec"))
39-
T = gn_basis_representation_rule(m)
40-
41-
return F2GNB{N, T}
42-
end
43-
44-
function F2GNB(x::BitVector)
45-
46-
N = length(x)
47-
F = concretize_type(F2GNB, N)
48-
49-
return F(x)
50-
end
51-
37+
concretize_type(::Type{F2GNB}, N::Int) = concretize_type(F2GNB, GNB(N))
5238

5339
function concretize_type(::Type{AffinePoint{Weierstrass, F}}, curve::ECP) where F <: PrimeField
5440

0 commit comments

Comments
 (0)