public class NetworkEncryptionUtils extends Object
Constructor and Description |
---|
NetworkEncryptionUtils() |
Modifier and Type | Method and Description |
---|---|
static Cipher |
cipherFromKey(int opMode,
Key key) |
private static byte[] |
crypt(int opMode,
Key key,
byte[] data) |
private static Cipher |
crypt(int opMode,
String algorithm,
Key key) |
static byte[] |
decrypt(Key key,
byte[] data) |
static SecretKey |
decryptSecretKey(PrivateKey privateKey,
byte[] encryptedSecretKey) |
static byte[] |
encrypt(Key key,
byte[] data) |
static SecretKey |
generateKey() |
static byte[] |
generateServerId(String baseServerId,
PublicKey publicKey,
SecretKey secretKey) |
static KeyPair |
generateServerKeyPair() |
private static byte[] |
hash(byte[][] byte2) |
static PublicKey |
readEncodedPublicKey(byte[] byte2) |
@Environment(value=CLIENT) public static SecretKey generateKey() throws NetworkEncryptionException
NetworkEncryptionException
public static KeyPair generateServerKeyPair() throws NetworkEncryptionException
NetworkEncryptionException
public static byte[] generateServerId(String baseServerId, PublicKey publicKey, SecretKey secretKey) throws NetworkEncryptionException
NetworkEncryptionException
@Environment(value=CLIENT) public static PublicKey readEncodedPublicKey(byte[] byte2) throws NetworkEncryptionException
NetworkEncryptionException
public static SecretKey decryptSecretKey(PrivateKey privateKey, byte[] encryptedSecretKey) throws NetworkEncryptionException
NetworkEncryptionException
@Environment(value=CLIENT) public static byte[] encrypt(Key key, byte[] data) throws NetworkEncryptionException
NetworkEncryptionException
public static byte[] decrypt(Key key, byte[] data) throws NetworkEncryptionException
NetworkEncryptionException
private static byte[] crypt(int opMode, Key key, byte[] data) throws NetworkEncryptionException
NetworkEncryptionException
private static Cipher crypt(int opMode, String algorithm, Key key) throws Exception
Exception
public static Cipher cipherFromKey(int opMode, Key key) throws NetworkEncryptionException
NetworkEncryptionException