Class EncryptionUtils

java.lang.Object
cn.nukkit.network.encryption.EncryptionUtils

@PowerNukkitXOnly public final class EncryptionUtils extends Object
  • Method Details

    • generateKey

      public static ECPublicKey generateKey(String b64) throws NoSuchAlgorithmException, InvalidKeySpecException
      Throws:
      NoSuchAlgorithmException
      InvalidKeySpecException
    • createKeyPair

      public static KeyPair createKeyPair()
    • signJwt

      public static void signJwt(com.nimbusds.jose.JWSObject jws, ECPrivateKey key) throws com.nimbusds.jose.JOSEException
      Throws:
      com.nimbusds.jose.JOSEException
    • verifyJwt

      public static boolean verifyJwt(com.nimbusds.jose.JWSObject jws, ECPublicKey key) throws com.nimbusds.jose.JOSEException
      Throws:
      com.nimbusds.jose.JOSEException
    • getSecretKey

      public static SecretKey getSecretKey(PrivateKey localPrivateKey, PublicKey remotePublicKey, byte[] token) throws InvalidKeyException
      Throws:
      InvalidKeyException
    • createHandshakeJwt

      public static com.nimbusds.jose.JWSObject createHandshakeJwt(KeyPair serverKeyPair, byte[] token) throws com.nimbusds.jose.JOSEException
      Throws:
      com.nimbusds.jose.JOSEException
    • generateRandomToken

      public static byte[] generateRandomToken()
    • getMojangPublicKey

      public static ECPublicKey getMojangPublicKey()
    • getOldMojangPublicKey

      public static ECPublicKey getOldMojangPublicKey()
    • createCipher

      public static Cipher createCipher(boolean gcm, boolean encrypt, SecretKey key)