Package net.i2p.crypto
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 SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static SigningPrivateKeyblind(SigningPrivateKey key, SigningPrivateKey alpha)Only for SigTypes EdDSA_SHA512_Ed25519 and RedDSA_SHA512_Ed25519.static SigningPublicKeyblind(SigningPublicKey key, SigningPrivateKey alpha)Only for SigTypes EdDSA_SHA512_Ed25519 and RedDSA_SHA512_Ed25519.static BlindDatadecode(I2PAppContext ctx, byte[] b)Decode a new-format b32 address.static BlindDatadecode(I2PAppContext ctx, String address)Decode a new-format b32 address.static Stringencode(SigningPublicKey key)Encode a public key as a new-format b32 address.static Stringencode(SigningPublicKey key, boolean requireSecret, boolean requireAuth)Encode a public key as a new-format b32 address.static SigningPrivateKeygenerateAlpha(I2PAppContext ctx, SigningPublicKey destspk, String secret)Generate alpha for current time.static SigningPrivateKeygenerateAlpha(I2PAppContext ctx, SigningPublicKey destspk, String secret, long now)Generate alpha for the given time.static SigTypegetDefaultBlindedType(SigType unblindedType)What's the default blinded type for a given unblinded type?static voidmain(String[] args)static SigningPrivateKeyunblind(SigningPrivateKey key, SigningPrivateKey alpha)Only for SigType EdDSA_SHA512_Ed25519.
 
- 
- 
- 
Method Detail- 
blindpublic 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
 
 - 
blindpublic 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
 
 - 
unblindpublic 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
 
 - 
generateAlphapublic 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
 
 - 
generateAlphapublic 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
 
 - 
getDefaultBlindedTypepublic static SigType getDefaultBlindedType(SigType unblindedType) What's the default blinded type for a given unblinded type?- Returns:
- non-null
- Since:
- 0.9.40
 
 - 
decodepublic 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
 
 - 
decodepublic 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
 
 - 
encodepublic 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
 
 - 
encodepublic 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
 
 
- 
 
-