public class Crypto
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected static char[] |
hexArray |
| Constructor and Description |
|---|
Crypto() |
| Modifier and Type | Method and Description |
|---|---|
static javax.crypto.Cipher |
createAESCipher()
Creating AES-CBC with PKCS#5 Padding scheme.
|
static javax.crypto.Mac |
createHmacSHA256()
Creating HMAC-SHA256.
|
static javax.crypto.Cipher |
createRSACipher()
Creating RSA with OAEP-SHA1-MGF1 Padding scheme
This cipher used for encryption of AES auth of message
|
static byte[] |
generateSeed(int size)
Generating of secure seed
|
static long |
generateSessionId()
Generation of session id for MTProto
|
static java.security.SecureRandom |
getSecureRandom()
Creating SecureRandom instance
|
static java.lang.String |
hex(byte[] bytes)
Calculating lowcase hex string
|
static byte[] |
SHA1(byte[] data)
Calculating SHA1
|
static byte[] |
SHA256(byte[] data)
Calculating SHA256
|
public static java.security.SecureRandom getSecureRandom()
public static javax.crypto.Cipher createAESCipher()
public static javax.crypto.Cipher createRSACipher()
public static javax.crypto.Mac createHmacSHA256()
public static byte[] generateSeed(int size)
size - seed ziepublic static long generateSessionId()
public static byte[] SHA256(byte[] data)
data - source datapublic static byte[] SHA1(byte[] data)
data - source datapublic static java.lang.String hex(byte[] bytes)
bytes - data for hex