Package cn.nukkit.network.encryption
Class EncryptionUtils
java.lang.Object
cn.nukkit.network.encryption.EncryptionUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic Cipher
createCipher
(boolean gcm, boolean encrypt, SecretKey key) static com.nimbusds.jose.JWSObject
createHandshakeJwt
(KeyPair serverKeyPair, byte[] token) static KeyPair
static ECPublicKey
generateKey
(String b64) static byte[]
static ECPublicKey
static ECPublicKey
static SecretKey
getSecretKey
(PrivateKey localPrivateKey, PublicKey remotePublicKey, byte[] token) static void
signJwt
(com.nimbusds.jose.JWSObject jws, ECPrivateKey key) static boolean
verifyJwt
(com.nimbusds.jose.JWSObject jws, ECPublicKey key)
-
Method Details
-
generateKey
public static ECPublicKey generateKey(String b64) throws NoSuchAlgorithmException, InvalidKeySpecException -
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
-
getOldMojangPublicKey
-
createCipher
-