Class Blinding


  • public final class Blinding
    extends Object
    Utilities for Blinding EdDSA keys. PRELIMINARY - Subject to change - see proposal 123
    Since:
    0.9.38
    • Method Detail

      • blind

        public static SigningPublicKey blind​(SigningPublicKey key,
                                             SigningPrivateKey alpha)
        Only for SigTypes EdDSA_SHA512_Ed25519 and RedDSA_SHA512_Ed25519.
        Parameters:
        key - must be SigType EdDSA_SHA512_Ed25519 or RedDSA_SHA512_Ed25519
        alpha - must be SigType RedDSA_SHA512_Ed25519
        Returns:
        SigType RedDSA_SHA512_Ed25519
        Throws:
        IllegalArgumentException - on bad inputs or unsupported SigTypes
      • blind

        public static SigningPrivateKey blind​(SigningPrivateKey key,
                                              SigningPrivateKey alpha)
        Only for SigTypes EdDSA_SHA512_Ed25519 and RedDSA_SHA512_Ed25519.
        Parameters:
        key - must be SigType EdDSA_SHA512_Ed25519 or RedDSA_SHA512_Ed25519
        alpha - must be SigType RedDSA_SHA512_Ed25519
        Returns:
        SigType RedDSA_SHA512_Ed25519
        Throws:
        IllegalArgumentException - on bad inputs or unsupported SigTypes
      • generateAlpha

        public static SigningPrivateKey generateAlpha​(I2PAppContext ctx,
                                                      SigningPublicKey destspk,
                                                      String secret)
        Generate alpha for current time. Only for SigType EdDSA_SHA512_Ed25519.
        Parameters:
        destspk - must be SigType EdDSA_SHA512_Ed25519
        secret - may be null or zero-length
        Returns:
        SigType RedDSA_SHA512_Ed25519
        Throws:
        IllegalArgumentException - on bad inputs or unsupported SigTypes
        Since:
        0.9.39
      • generateAlpha

        public static SigningPrivateKey generateAlpha​(I2PAppContext ctx,
                                                      SigningPublicKey destspk,
                                                      String secret,
                                                      long now)
        Generate alpha for the given time. Only for SigType EdDSA_SHA512_Ed25519 or RedDSA_SHA512_Ed25519.
        Parameters:
        destspk - must be SigType EdDSA_SHA512_Ed25519 or RedDSA_SHA512_Ed25519
        secret - may be null or zero-length
        now - for what time?
        Returns:
        SigType RedDSA_SHA512_Ed25519
        Throws:
        IllegalArgumentException - on bad inputs or unsupported SigTypes
        Since:
        0.9.39
      • getDefaultBlindedType

        public static SigType getDefaultBlindedType​(SigType unblindedType)
        What's the default blinded type for a given unblinded type?
        Returns:
        non-null
        Since:
        0.9.40
      • decode

        public static BlindData decode​(I2PAppContext ctx,
                                       byte[] b)
                                throws IllegalArgumentException
        Decode a new-format b32 address. See proposal 149. NOTE: Not for external use, use decode(String)
        Parameters:
        b - 35+ bytes
        Returns:
        BlindData structure, use getUnblindedPubKey() for the result
        Throws:
        IllegalArgumentException - on bad inputs or unsupported SigTypes
        Since:
        0.9.40