org.sigilaris.core.crypto
Members list
Packages
Type members
Classlikes
JVM implementation of cryptographic operations using BouncyCastle.
JVM implementation of cryptographic operations using BouncyCastle.
Provides secp256k1 elliptic curve operations including:
- Keccak-256 hashing (thread-safe via pool)
- Key pair generation and derivation
- ECDSA signing with deterministic k (RFC 6979) and Low-S normalization
- Public key recovery from signatures
All operations use BouncyCastle's secp256k1 implementation with performance optimizations including thread-local digest pooling and optional coordinate caching.
Attributes
- See also
-
CryptoOpsLike for the cross-platform interface
org.sigilaris.core.crypto.internal.CryptoParams for curve parameters
org.sigilaris.core.crypto.internal.KeccakPool for hashing implementation
- Note
-
This is the JVM-specific implementation. Cross-platform code should use CryptoOpsLike interface.
- Example
-
// Generate a key pair val keyPair = CryptoOps.generate() // Hash and sign val message = "hello".getBytes val hash = CryptoOps.keccak256(message) val sig = CryptoOps.sign(keyPair, hash).toOption.get // Recover public key val recovered = CryptoOps.recover(sig, hash) assert(recovered.contains(keyPair.publicKey)) - Source
- CryptoOps.scala
- Supertypes
- Self type
-
CryptoOps.type
Cross-platform minimal CryptoOps surface to unify JS/JVM APIs.
Cross-platform minimal CryptoOps surface to unify JS/JVM APIs.
Provides cryptographic primitives for secp256k1 elliptic curve operations including hashing, key pair generation, signing, and signature recovery. Platform-specific implementations exist for JS (via elliptic.js) and JVM (via BouncyCastle).
Attributes
- See also
-
org.sigilaris.core.crypto.CryptoOps for platform-specific implementations
- Source
- CryptoOpsLike.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
object CryptoOps
Type class for Keccak-256 hashing.
Type class for Keccak-256 hashing.
Provides a type-safe way to hash values of type A, returning a tagged hash value that remembers its source type. The hash is computed using Keccak-256 (32 bytes).
Type parameters
- A
-
the type of value to hash
Attributes
- See also
-
CryptoOps.keccak256 for the underlying hash function
- Example
-
import Hash.ops.* // Hash a UTF-8 string val utf8Hash: Hash.Value[Utf8] = Utf8("hello").toHash // Build custom hash instance given Hash[MyType] = Hash.build[MyType] - Companion
- object
- Source
- Hash.scala
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Companion
- trait
- Source
- Hash.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Hash.type
An ECDSA secp256k1 key pair consisting of a private and public key.
An ECDSA secp256k1 key pair consisting of a private and public key.
The key pair enables cryptographic operations such as signing transactions and recovering public keys from signatures.
Value parameters
- privateKey
-
32-byte private key as datatype.UInt256, must be in range [1, n-1] where n is the secp256k1 curve order
- publicKey
-
corresponding 64-byte uncompressed public key (x||y coordinates)
Attributes
- See also
-
CryptoOps.generate for key pair generation
CryptoOps.fromPrivate for deriving from private key
- Example
-
// Generate a new key pair val keyPair = CryptoOps.generate() // Derive from existing private key val privateKey = UInt256.fromHex("0123...").toOption.get val keyPair2 = CryptoOps.fromPrivate(privateKey.toBigInt) - Source
- KeyPair.scala
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
JVM implementation of secp256k1 public key with caching optimizations.
JVM implementation of secp256k1 public key with caching optimizations.
Represents an uncompressed secp256k1 public key (64 bytes = x||y) with two internal representations:
- PublicKey.XY: stores x and y coordinates directly
- PublicKey.Point: stores BouncyCastle ECPoint and lazily computes x/y
Both representations cache intermediate values (byte arrays, coordinates, EC points) for performance, controlled by org.sigilaris.core.crypto.internal.CryptoParams.CachePolicy.
Attributes
- See also
-
PublicKeyLike for the cross-platform interface
org.sigilaris.core.crypto.internal.CryptoParams.CachePolicy for caching behavior
- Note
-
Equality and hashCode are based solely on the 64-byte x||y representation, ensuring consistency across both internal forms.
- Companion
- object
- Source
- PublicKey.scala
- Supertypes
- Known subtypes
Attributes
- Companion
- trait
- Source
- PublicKey.scala
- Supertypes
-
trait Sumtrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
PublicKey.type
Cross-platform minimal PublicKey surface to unify JS/JVM APIs.
Cross-platform minimal PublicKey surface to unify JS/JVM APIs.
Represents an uncompressed secp256k1 public key with explicit x and y coordinates. The 64-byte representation consists of x and y coordinates concatenated (x||y), each being 32 bytes, big-endian.
Attributes
- See also
-
org.sigilaris.core.crypto.PublicKey for platform-specific implementations
- Source
- PublicKeyLike.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
Type class for recovering public keys from ECDSA signatures.
Type class for recovering public keys from ECDSA signatures.
Provides a type-safe interface for recovering the public key that was used to create a signature. The recovery process first hashes the value using Hash, then uses the signature's recovery parameter to recover the public key.
Type parameters
- A
-
the type of value that was signed
Attributes
- See also
-
Sign for signature creation
Signature for the signature representation
CryptoOps.recover for the underlying recovery operation
- Example
-
import Recover.ops.* val keyPair = CryptoOps.generate() val message = Utf8("hello") val signature = keyPair.sign(message).toOption.get // Recover public key from signature val hash = message.toHash val recovered: Either[SigilarisFailure, PublicKey] = hash.recover(signature) assert(recovered.contains(keyPair.publicKey)) - Companion
- object
- Source
- Recover.scala
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Companion
- trait
- Source
- Recover.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Recover.type
Type class for ECDSA signing operations.
Type class for ECDSA signing operations.
Provides a type-safe interface for signing values of type A. The signing process first hashes the value using Hash, then signs the hash with ECDSA using the provided key pair.
Type parameters
- A
-
the type of value to sign
Attributes
- See also
-
Hash for hashing values
Signature for the signature representation
CryptoOps.sign for the underlying signing operation
- Example
-
import Sign.ops.* val keyPair = CryptoOps.generate() val message = Utf8("hello") // Sign a message val signature: Either[SigilarisFailure, Signature] = keyPair.sign(message) // Sign a pre-computed hash val hash = message.toHash val sig2 = hash.signBy(keyPair) - Companion
- object
- Source
- Sign.scala
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Companion
- trait
- Source
- Sign.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Sign.type
ECDSA signature with recovery parameter for secp256k1.
ECDSA signature with recovery parameter for secp256k1.
Represents a recoverable ECDSA signature consisting of (v, r, s) where:
- v is the recovery parameter (27-30) allowing public key recovery
- r is the x-coordinate of the ephemeral public key
- s is the signature proof value
Value parameters
- r
-
signature component r, 32-byte datatype.UInt256
- s
-
signature component s, 32-byte datatype.UInt256, normalized to Low-S form (s ≤ n/2)
- v
-
recovery parameter, typically 27 or 28 (27 + recId where recId is 0 or 1)
Attributes
- See also
-
Sign for signature creation
Recover for public key recovery
CryptoOps.sign for signing
CryptoOps.recover for recovery
- Note
-
Signatures are normalized to Low-S form (s ≤ n/2) to prevent malleability
- Example
-
val keyPair = CryptoOps.generate() val hash = CryptoOps.keccak256("message".getBytes) val signature = CryptoOps.sign(keyPair, hash).toOption.get // Recover public key from signature val recovered = CryptoOps.recover(signature, hash) - Source
- Signature.scala
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all