Package com.privatechain.crypto


package com.privatechain.crypto
Cryptographic primitives for the private-blockchain library — hashing, ECDSA signing, key-pair generation, address derivation, and Merkle trees.

All classes in this package are stateless utilities (all methods are static) backed by Bouncy Castle 1.84 over the secp256k1 elliptic curve. The module adds no mandatory transitive dependencies beyond Bouncy Castle — consuming modules that do not need cryptography can depend solely on blockchain-core.

Key classes:

  • HashUtil — sha256(), sha3_256(), doubleHash(); all return lowercase hex strings (FR-CRYPTO-01–03).
  • ECKeyPair — immutable secp256k1 key pair; toString() masks the private key with [REDACTED] (NFR-SEC-01).
  • KeyPairGenerator — generates and imports ECKeyPair instances (FR-CRYPTO-08).
  • ECDSASignatureUtil — ECDSA sign and verify over secp256k1 (FR-CRYPTO-04, FR-CRYPTO-05).
  • AddressUtil — derives a blockchain address from a public key via SHA-256 → RIPEMD-160 → Base58Check (FR-CRYPTO-09).
  • MerkleTree — builds Merkle roots and generates inclusion proofs for transaction sets (FR-CRYPTO-06, FR-CRYPTO-07).

Security note: All random number generation uses SecureRandom (NFR-SEC-05). Private key material is never written to logs or returned from toString() in any class in this package.

Since:
1.0.0
  • Classes
    Class
    Description
    Utility class for deriving a blockchain address from an EC public key.
    Utility class for ECDSA signing and signature verification using the secp256k1 elliptic curve and the SHA-256withECDSA algorithm.
    Immutable record holding an elliptic-curve key pair generated on the secp256k1 curve.
    Utility class providing cryptographic hash functions used throughout the blockchain.
    Factory for generating and reconstructing elliptic-curve key pairs on the secp256k1 curve.
    Builds a binary Merkle tree from a list of transaction IDs and exposes root computation, inclusion-proof generation, and proof verification.
    Immutable Merkle inclusion proof for a single transaction.
    Immutable value holding a sibling hash and its relative position at one level of the Merkle tree.