public final class Blinding extends Object
Modifier and Type | Method and Description |
---|---|
static 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 |
main(String[] args) |
static SigningPrivateKey |
unblind(SigningPrivateKey key,
SigningPrivateKey alpha)
Only for SigType EdDSA_SHA512_Ed25519.
|
public static SigningPublicKey blind(SigningPublicKey key, SigningPrivateKey alpha)
key
- must be SigType EdDSA_SHA512_Ed25519 or RedDSA_SHA512_Ed25519alpha
- must be SigType RedDSA_SHA512_Ed25519IllegalArgumentException
- on bad inputs or unsupported SigTypespublic static SigningPrivateKey blind(SigningPrivateKey key, SigningPrivateKey alpha)
key
- must be SigType EdDSA_SHA512_Ed25519 or RedDSA_SHA512_Ed25519alpha
- must be SigType RedDSA_SHA512_Ed25519IllegalArgumentException
- on bad inputs or unsupported SigTypespublic static SigningPrivateKey unblind(SigningPrivateKey key, SigningPrivateKey alpha)
key
- must be SigType RedDSA_SHA512_Ed25519alpha
- must be SigType RedDSA_SHA512_Ed25519IllegalArgumentException
- on bad inputs or unsupported SigTypespublic static SigningPrivateKey generateAlpha(I2PAppContext ctx, SigningPublicKey destspk, String secret)
destspk
- must be SigType EdDSA_SHA512_Ed25519secret
- may be null or zero-lengthIllegalArgumentException
- on bad inputs or unsupported SigTypespublic static SigningPrivateKey generateAlpha(I2PAppContext ctx, SigningPublicKey destspk, String secret, long now)
destspk
- must be SigType EdDSA_SHA512_Ed25519 or RedDSA_SHA512_Ed25519secret
- may be null or zero-lengthnow
- for what time?IllegalArgumentException
- on bad inputs or unsupported SigTypespublic static SigType getDefaultBlindedType(SigType unblindedType)
public static BlindData decode(I2PAppContext ctx, String address) throws IllegalArgumentException
address
- ending with ".b32.i2p"IllegalArgumentException
- on bad inputs or unsupported SigTypespublic static BlindData decode(I2PAppContext ctx, byte[] b) throws IllegalArgumentException
b
- 35+ bytesIllegalArgumentException
- on bad inputs or unsupported SigTypespublic static String encode(SigningPublicKey key) throws IllegalArgumentException
IllegalArgumentException
- on bad inputs or unsupported SigTypespublic static String encode(SigningPublicKey key, boolean requireSecret, boolean requireAuth) throws IllegalArgumentException
IllegalArgumentException
- on bad inputs or unsupported SigTypes