Package nxt.crypto
Class Crypto
java.lang.Object
nxt.crypto.Crypto
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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 voidclamp(byte[] key) Clamping is used to protect a key against common attacks on Ed25519 and Curve25519.static voidcurve(byte[] Z, byte[] k, byte[] P) static byte[]getKeySeed(byte[] privateKey, byte[]... nonces) static MessageDigestgetMessageDigest(String algorithm) static byte[]getPrivateKey(byte[] keySeed) static byte[]getPrivateKey(String secretPhrase) static byte[]getPublicKey(byte[] privateKey) static SecureRandomstatic byte[]getSharedKey(byte[] myPrivateKey, byte[] theirPublicKey) static byte[]getSharedKey(byte[] myPrivateKey, byte[] theirPublicKey, byte[] nonce) static booleanisCanonicalPublicKey(byte[] publicKey) static booleanisCanonicalSignature(byte[] signature) static MessageDigeststatic MessageDigestsha256()static MessageDigestsha3()static byte[]sign(byte[] message, byte[] privateKey) static booleanverify(byte[] signature, byte[] message, byte[] publicKey)
-
Method Details
-
getSecureRandom
-
getMessageDigest
-
sha256
-
ripemd160
-
sha3
-
getKeySeed
public static byte[] getKeySeed(byte[] privateKey, byte[]... nonces) -
getPublicKey
public static byte[] getPublicKey(byte[] privateKey) -
getPrivateKey
public static byte[] getPrivateKey(byte[] keySeed) -
getPrivateKey
-
curve
public static void curve(byte[] Z, byte[] k, byte[] P) -
sign
public static byte[] sign(byte[] message, byte[] privateKey) -
verify
public static boolean verify(byte[] signature, byte[] message, byte[] publicKey) -
aesEncrypt
public static byte[] aesEncrypt(byte[] plaintext, byte[] key) -
aesGCMEncrypt
public static byte[] aesGCMEncrypt(byte[] plaintext, byte[] key) -
aesDecrypt
public static byte[] aesDecrypt(byte[] ivCiphertext, byte[] key) -
aesGCMDecrypt
public static byte[] aesGCMDecrypt(byte[] ivCiphertext, byte[] key) -
isCanonicalPublicKey
public static boolean isCanonicalPublicKey(byte[] publicKey) -
isCanonicalSignature
public static boolean isCanonicalSignature(byte[] signature) -
clamp
public static void clamp(byte[] key) Clamping is used to protect a key against common attacks on Ed25519 and Curve25519. In our case the lowest 3 bits of the first byte of the key of are cleared, the highest bit of the last byte is cleared, and the second highest bit of the last byte is set.- Parameters:
key- the key to clamp
-