Package net.i2p.crypto
Class Blinding
java.lang.Object
net.i2p.crypto.Blinding
Utilities for Blinding EdDSA keys.
PRELIMINARY - Subject to change - see proposal 123
- Since:
- 0.9.38
-
Method Summary
Modifier and TypeMethodDescriptionstatic SigningPrivateKey
blind
(SigningPrivateKey key, SigningPrivateKey alpha) Only for SigTypes EdDSA_SHA512_Ed25519 and RedDSA_SHA512_Ed25519.static SigningPublicKey
blind
(SigningPublicKey key, SigningPrivateKey alpha) Only for SigTypes EdDSA_SHA512_Ed25519 and RedDSA_SHA512_Ed25519.static BlindData
decode
(I2PAppContext ctx, byte[] b) Decode a new-format b32 address.static BlindData
decode
(I2PAppContext ctx, String address) Decode a new-format b32 address.static String
encode
(SigningPublicKey key) Encode a public key as a new-format b32 address.static String
encode
(SigningPublicKey key, boolean requireSecret, boolean requireAuth) Encode a public key as a new-format b32 address.static SigningPrivateKey
generateAlpha
(I2PAppContext ctx, SigningPublicKey destspk, String secret) Generate alpha for current time.static SigningPrivateKey
generateAlpha
(I2PAppContext ctx, SigningPublicKey destspk, String secret, long now) Generate alpha for the given time.static SigType
getDefaultBlindedType
(SigType unblindedType) What's the default blinded type for a given unblinded type?static void
static SigningPrivateKey
unblind
(SigningPrivateKey key, SigningPrivateKey alpha) Only for SigType EdDSA_SHA512_Ed25519.
-
Method Details
-
blind
Only for SigTypes EdDSA_SHA512_Ed25519 and RedDSA_SHA512_Ed25519.- Parameters:
key
- must be SigType EdDSA_SHA512_Ed25519 or RedDSA_SHA512_Ed25519alpha
- must be SigType RedDSA_SHA512_Ed25519- Returns:
- SigType RedDSA_SHA512_Ed25519
- Throws:
IllegalArgumentException
- on bad inputs or unsupported SigTypes
-
blind
Only for SigTypes EdDSA_SHA512_Ed25519 and RedDSA_SHA512_Ed25519.- Parameters:
key
- must be SigType EdDSA_SHA512_Ed25519 or RedDSA_SHA512_Ed25519alpha
- must be SigType RedDSA_SHA512_Ed25519- Returns:
- SigType RedDSA_SHA512_Ed25519
- Throws:
IllegalArgumentException
- on bad inputs or unsupported SigTypes
-
unblind
Only for SigType EdDSA_SHA512_Ed25519.- Parameters:
key
- must be SigType RedDSA_SHA512_Ed25519alpha
- 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_Ed25519secret
- 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_Ed25519secret
- may be null or zero-lengthnow
- for what time?- Returns:
- SigType RedDSA_SHA512_Ed25519
- Throws:
IllegalArgumentException
- on bad inputs or unsupported SigTypes- Since:
- 0.9.39
-
getDefaultBlindedType
What's the default blinded type for a given unblinded type?- Returns:
- non-null
- Since:
- 0.9.40
-
decode
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
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
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
- Throws:
Exception
-