Package zeroecho.sdk.util


package zeroecho.sdk.util
Utility helpers for provider setup, key derivation, randomness, encoding, and X.509 handling.

This package gathers small, focused utilities used across the SDK: activation of Bouncy Castle providers, RFC 5869 HKDF helpers, adapters that expose output-style transforms as readable streams, streaming decoders for length-prefixed payloads, password helpers, random-byte support, and simple X.509 PEM utilities.

Key elements

  • BouncyCastleActivator - one-time registration of Bouncy Castle providers. A static initializer adds providers; BouncyCastleActivator.init() can be called explicitly to confirm activation.
  • Kdf - HKDF-SHA-256 derivation utilities for producing symmetric keys from KEM or agreement secrets.
  • OutputToInputStreamAdapter - base class that adapts an OutputStream driven transformation into an InputStream; subclasses provide the transforming output and the adapter exposes transformed bytes as they become available.
  • Pack7LStreamWriter - incremental writer that consumes a 7-bit packed length prefix, then copies exactly that many payload bytes to a target stream.
  • Password - helpers for generating random bytes and printable passwords.
  • X509Support - minimal PEM-based load and print helpers for certificates, private keys, and certificate signing requests.

Typical usage

// Ensure Bouncy Castle providers are present.
zeroecho.sdk.util.BouncyCastleActivator.init();

// Derive 32 bytes with HKDF-SHA-256 for a symmetric key.
byte[] key = zeroecho.sdk.util.Kdf.hkdfSha256(ikm, salt, info, 32);

Design notes

  • Utilities avoid retaining sensitive material and prefer cloning caller arrays where appropriate.
  • Streaming adapters do not buffer whole payloads except where transform semantics require it.
  • Provider setup is explicit and emits concise diagnostics to aid development.
Since:
1.0
  • Classes
    Class
    Description
    BIKE-256 key pair utilities for modules that depend on zeroecho.lib.
    Provides initialization support for the Bouncy Castle cryptographic provider.
    HKDF utilities for deriving symmetric keys from a KEM shared secret.
    An abstract adapter that converts an OutputStream-based transformation (such as encryption or compression) into an InputStream-based one.
    A streaming writer that reads a variable-length 7-bit encoded length prefix from the input data and writes the subsequent payload to a target OutputStream.
    Utility class for generating random passwords and secure random byte arrays.
    Utility class providing support for working with X.509 certificates, private keys, and certification requests using PEM-encoded files and the Bouncy Castle library.