public final class Crypto
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static byte[] |
aesDecrypt(byte[] ivCiphertext,
byte[] key) |
static byte[] |
aesEncrypt(byte[] plaintext,
byte[] key) |
static byte[] |
aesGCMDecrypt(byte[] ivCiphertext,
byte[] key) |
static byte[] |
aesGCMEncrypt(byte[] plaintext,
byte[] key) |
static void |
clamp(byte[] key)
Clamping is used to protect a key against common attacks on Ed25519 and Curve25519.
|
static void |
curve(byte[] Z,
byte[] k,
byte[] P) |
static byte[] |
getKeySeed(byte[] privateKey,
byte[]... nonces) |
static java.security.MessageDigest |
getMessageDigest(java.lang.String algorithm) |
static byte[] |
getPrivateKey(byte[] keySeed) |
static byte[] |
getPrivateKey(java.lang.String secretPhrase) |
static byte[] |
getPublicKey(byte[] privateKey) |
static java.security.SecureRandom |
getSecureRandom() |
static byte[] |
getSharedKey(byte[] myPrivateKey,
byte[] theirPublicKey) |
static byte[] |
getSharedKey(byte[] myPrivateKey,
byte[] theirPublicKey,
byte[] nonce) |
static boolean |
isCanonicalPublicKey(byte[] publicKey) |
static boolean |
isCanonicalSignature(byte[] signature) |
static java.security.MessageDigest |
ripemd160() |
static java.security.MessageDigest |
sha256() |
static java.security.MessageDigest |
sha3() |
static byte[] |
sign(byte[] message,
byte[] privateKey) |
static boolean |
verify(byte[] signature,
byte[] message,
byte[] publicKey) |
public static java.security.SecureRandom getSecureRandom()
public static java.security.MessageDigest getMessageDigest(java.lang.String algorithm)
public static java.security.MessageDigest sha256()
public static java.security.MessageDigest ripemd160()
public static java.security.MessageDigest sha3()
public static byte[] getKeySeed(byte[] privateKey, byte[]... nonces)
public static byte[] getPublicKey(byte[] privateKey)
public static byte[] getPrivateKey(byte[] keySeed)
public static byte[] getPrivateKey(java.lang.String secretPhrase)
public static void curve(byte[] Z, byte[] k, byte[] P)
public static byte[] sign(byte[] message, byte[] privateKey)
public static boolean verify(byte[] signature, byte[] message, byte[] publicKey)
public static byte[] getSharedKey(byte[] myPrivateKey, byte[] theirPublicKey)
public static byte[] getSharedKey(byte[] myPrivateKey, byte[] theirPublicKey, byte[] nonce)
public static byte[] aesEncrypt(byte[] plaintext, byte[] key)
public static byte[] aesGCMEncrypt(byte[] plaintext, byte[] key)
public static byte[] aesDecrypt(byte[] ivCiphertext, byte[] key)
public static byte[] aesGCMDecrypt(byte[] ivCiphertext, byte[] key)
public static boolean isCanonicalPublicKey(byte[] publicKey)
public static boolean isCanonicalSignature(byte[] signature)
public static void clamp(byte[] key)
key
- the key to clamp