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)
Command-line tool for encoding/decoding b32 addresses.
|
static SigningPrivateKey |
unblind(SigningPrivateKey key,
SigningPrivateKey alpha)
Only for SigType EdDSA_SHA512_Ed25519.
|
public 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 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 BlindData decode(I2PAppContext ctx, byte[] b) throws IllegalArgumentException
ctx - the application contextb - 35+ bytesIllegalArgumentException - on bad inputs or unsupported SigTypespublic static BlindData decode(I2PAppContext ctx, String address) throws IllegalArgumentException
ctx - the application contextaddress - ending with ".b32.i2p"IllegalArgumentException - on bad inputs or unsupported SigTypespublic static String encode(SigningPublicKey key) throws IllegalArgumentException
key - the signing public key to encodeIllegalArgumentException - on bad inputs or unsupported SigTypespublic static String encode(SigningPublicKey key, boolean requireSecret, boolean requireAuth) throws IllegalArgumentException
key - the signing public key to encoderequireSecret - whether a secret is requiredrequireAuth - whether authentication is requiredIllegalArgumentException - on bad inputs or unsupported SigTypespublic static SigningPrivateKey generateAlpha(I2PAppContext ctx, SigningPublicKey destspk, String secret)
ctx - the application contextdestspk - 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)
ctx - the application contextdestspk - must be SigType EdDSA_SHA512_Ed25519 or RedDSA_SHA512_Ed25519secret - may be null or zero-lengthnow - the time in milliseconds for which to generate alphaIllegalArgumentException - on bad inputs or unsupported SigTypespublic static SigType getDefaultBlindedType(SigType unblindedType)
unblindedType - the unblinded signature typepublic static void main(String[] args) throws Exception
args - command-line argumentsException - on errorpublic 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 SigTypes