Package nxt.crypto

Class Crypto


  • public final class Crypto
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method 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 curve​(byte[] Z, byte[] k, byte[] P)  
      static byte[] getKeySeed​(java.lang.String secretPhrase, 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[] keySeed)  
      static byte[] getPublicKey​(java.lang.String secretPhrase)  
      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 long rsDecode​(java.lang.String rsString)  
      static java.lang.String rsEncode​(long id)  
      static java.security.MessageDigest sha256()  
      static java.security.MessageDigest sha3()  
      static byte[] sign​(byte[] message, java.lang.String secretPhrase)  
      static boolean verify​(byte[] signature, byte[] message, byte[] publicKey)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getSecureRandom

        public static java.security.SecureRandom getSecureRandom()
      • getMessageDigest

        public static java.security.MessageDigest getMessageDigest​(java.lang.String algorithm)
      • sha256

        public static java.security.MessageDigest sha256()
      • ripemd160

        public static java.security.MessageDigest ripemd160()
      • sha3

        public static java.security.MessageDigest sha3()
      • getKeySeed

        public static byte[] getKeySeed​(java.lang.String secretPhrase,
                                        byte[]... nonces)
      • getPublicKey

        public static byte[] getPublicKey​(byte[] keySeed)
      • getPublicKey

        public static byte[] getPublicKey​(java.lang.String secretPhrase)
      • getPrivateKey

        public static byte[] getPrivateKey​(byte[] keySeed)
      • getPrivateKey

        public static byte[] getPrivateKey​(java.lang.String secretPhrase)
      • curve

        public static void curve​(byte[] Z,
                                 byte[] k,
                                 byte[] P)
      • sign

        public static byte[] sign​(byte[] message,
                                  java.lang.String secretPhrase)
      • verify

        public static boolean verify​(byte[] signature,
                                     byte[] message,
                                     byte[] publicKey)
      • getSharedKey

        public static byte[] getSharedKey​(byte[] myPrivateKey,
                                          byte[] theirPublicKey)
      • getSharedKey

        public static byte[] getSharedKey​(byte[] myPrivateKey,
                                          byte[] theirPublicKey,
                                          byte[] nonce)
      • 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)
      • rsEncode

        public static java.lang.String rsEncode​(long id)
      • rsDecode

        public static long rsDecode​(java.lang.String rsString)
      • isCanonicalPublicKey

        public static boolean isCanonicalPublicKey​(byte[] publicKey)
      • isCanonicalSignature

        public static boolean isCanonicalSignature​(byte[] signature)