Object.AdvancedCrypto (object v0.1.2)

Advanced cryptographic capabilities including post-quantum cryptography, zero-knowledge proofs, and homomorphic encryption for AAOS.

Features

  • CRYSTALS-Kyber (post-quantum key encapsulation)
  • CRYSTALS-Dilithium (post-quantum digital signatures)
  • zk-SNARKs for privacy-preserving computation
  • Homomorphic encryption for computation on encrypted data
  • Threshold cryptography for distributed trust
  • Verifiable delay functions for consensus
  • Ring signatures for anonymity

Summary

Functions

Returns a specification to start this module under a supervisor.

Creates a ring signature for anonymous authentication.

Creates a threshold secret sharing scheme.

Creates a verifiable delay function proof.

Generates post-quantum cryptographic keypairs.

Performs homomorphic addition on encrypted data.

Encrypts data using homomorphic encryption.

Performs post-quantum key decapsulation.

Performs post-quantum key encapsulation.

Reconstructs a secret from threshold shares.

Starts the advanced cryptography service.

Verifies a zero-knowledge proof.

Types

homomorphic_ciphertext()

@type homomorphic_ciphertext() :: %{
  ciphertext: binary(),
  public_key_hash: binary(),
  noise_level: non_neg_integer(),
  scheme: :bfv | :ckks | :bgv
}

pq_keypair()

@type pq_keypair() :: %{
  public: binary(),
  secret: binary(),
  algorithm: :kyber | :dilithium
}

state()

@type state() :: %{
  pq_identity: %{kyber_keypair: pq_keypair(), dilithium_keypair: pq_keypair()},
  zksnark_circuits: %{required(binary()) => map()},
  homomorphic_keys: %{required(binary()) => map()},
  threshold_schemes: %{required(binary()) => map()},
  vdf_parameters: map(),
  ring_signatures: %{required(binary()) => map()}
}

threshold_share()

@type threshold_share() :: %{
  share_id: non_neg_integer(),
  value: binary(),
  threshold: non_neg_integer(),
  total_shares: non_neg_integer()
}

zkproof()

@type zkproof() :: %{
  proof: binary(),
  public_inputs: [binary()],
  circuit_hash: binary(),
  verification_key: binary()
}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

create_ring_signature(message, ring_public_keys, signer_secret_key)

@spec create_ring_signature(binary(), [binary()], binary()) ::
  {:ok, binary()} | {:error, term()}

Creates a ring signature for anonymous authentication.

create_threshold_scheme(secret, threshold, total_shares)

@spec create_threshold_scheme(binary(), non_neg_integer(), non_neg_integer()) ::
  {:ok, [threshold_share()]} | {:error, term()}

Creates a threshold secret sharing scheme.

create_vdf_proof(input, delay_steps)

@spec create_vdf_proof(binary(), non_neg_integer()) ::
  {:ok, {binary(), binary()}} | {:error, term()}

Creates a verifiable delay function proof.

create_zkproof(circuit_id, public_inputs, private_inputs)

@spec create_zkproof(binary(), [binary()], [binary()]) ::
  {:ok, zkproof()} | {:error, term()}

Creates a zero-knowledge proof.

generate_pq_identity()

@spec generate_pq_identity() :: {:ok, map()} | {:error, term()}

Generates post-quantum cryptographic keypairs.

homomorphic_add(ct1, ct2)

@spec homomorphic_add(homomorphic_ciphertext(), homomorphic_ciphertext()) ::
  {:ok, homomorphic_ciphertext()} | {:error, term()}

Performs homomorphic addition on encrypted data.

homomorphic_encrypt(data, public_key_id)

@spec homomorphic_encrypt(binary(), binary()) ::
  {:ok, homomorphic_ciphertext()} | {:error, term()}

Encrypts data using homomorphic encryption.

pq_decapsulate(ciphertext)

@spec pq_decapsulate(binary()) :: {:ok, binary()} | {:error, term()}

Performs post-quantum key decapsulation.

pq_encapsulate(public_key)

@spec pq_encapsulate(binary()) :: {:ok, {binary(), binary()}} | {:error, term()}

Performs post-quantum key encapsulation.

reconstruct_threshold_secret(shares)

@spec reconstruct_threshold_secret([threshold_share()]) ::
  {:ok, binary()} | {:error, term()}

Reconstructs a secret from threshold shares.

start_link(opts \\ [])

Starts the advanced cryptography service.

verify_zkproof(proof)

@spec verify_zkproof(zkproof()) :: boolean()

Verifies a zero-knowledge proof.