Class Blinding

java.lang.Object
net.i2p.crypto.Blinding

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

    • 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
    • unblind

      public static SigningPrivateKey unblind(SigningPrivateKey key, SigningPrivateKey alpha)
      Only for SigType EdDSA_SHA512_Ed25519.
      Parameters:
      key - must be SigType RedDSA_SHA512_Ed25519
      alpha - must be SigType RedDSA_SHA512_Ed25519
      Returns:
      SigType EdDSA_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, String address) throws IllegalArgumentException
      Decode a new-format b32 address. See proposal 149.
      Parameters:
      address - ending with ".b32.i2p"
      Returns:
      BlindData structure, use getUnblindedPubKey() for the result
      Throws:
      IllegalArgumentException - on bad inputs or unsupported SigTypes
      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
    • encode

      public static String encode(SigningPublicKey key) throws IllegalArgumentException
      Encode a public key as a new-format b32 address. See proposal 149.
      Returns:
      (56 chars).b32.i2p
      Throws:
      IllegalArgumentException - on bad inputs or unsupported SigTypes
      Since:
      0.9.40
    • encode

      public static String encode(SigningPublicKey key, boolean requireSecret, boolean requireAuth) throws IllegalArgumentException
      Encode a public key as a new-format b32 address. See proposal 149.
      Returns:
      (56 chars).b32.i2p
      Throws:
      IllegalArgumentException - on bad inputs or unsupported SigTypes
      Since:
      0.9.40
    • main

      public static void main(String[] args) throws Exception
      Throws:
      Exception