|
||||||||||
上一个类 下一个类 | 框架 无框架 | |||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |
java.lang.Object gboat2.base.bridge.util.security.Encryptor
public class Encryptor
字段摘要 | |
---|---|
static String |
MD2
The MD2 message digest algorithm defined in RFC 1319. |
static String |
MD5
The MD5 message digest algorithm defined in RFC 1321. |
static String |
SHA
Secure Hash Algorithm,安全散列算法 |
static String |
SHA_1
The SHA-1 hash algorithm defined in the FIPS PUB 180-2. |
static String |
SHA_256
The SHA-256 hash algorithm defined in the FIPS PUB 180-2. |
static String |
SHA_384
The SHA-384 hash algorithm defined in the FIPS PUB 180-2. |
static String |
SHA_512
The SHA-512 hash algorithm defined in the FIPS PUB 180-2. |
构造方法摘要 | |
---|---|
Encryptor()
|
方法摘要 | |
---|---|
static byte[] |
decrypt(byte[] data,
Key key,
String transformation)
对数据进行解密 |
static byte[] |
digest(byte[] data,
String algorithm)
|
static byte[] |
digest(File file,
String algorithm)
|
static byte[] |
digest(String data,
String algorithm)
|
static byte[] |
encrypt(byte[] data,
Key key,
String transformation)
对数据进行加密 |
protected static String |
getAlgorithmFromTransformation(String transformation)
取得算法名称 |
static KeyGenerator |
getKeyGenerator(String algorithm)
获取密钥生成器实例 |
static KeyPair |
getKeyPair(String algorithm,
int size)
根据算法名称和密钥长度生成私钥公钥对 |
static MessageDigest |
getMessageDigest(String algorithm)
获取 MessageDigest 实例 |
从类 java.lang.Object 继承的方法 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
字段详细信息 |
---|
public static final String MD2
public static final String MD5
public static final String SHA
public static final String SHA_1
public static final String SHA_256
public static final String SHA_384
public static final String SHA_512
构造方法详细信息 |
---|
public Encryptor()
方法详细信息 |
---|
public static MessageDigest getMessageDigest(String algorithm)
algorithm
- 加密算法,请参见本类中的名称为 MD*
和 SHA*
的常量
public static byte[] digest(byte[] data, String algorithm)
data
- 要加密的数据algorithm
- 加密算法,请参见本类中的名称为 MD*
和 SHA*
的常量
public static byte[] digest(String data, String algorithm)
data
- 要加密的字符串algorithm
- 加密算法,请参见本类中的名称为 MD*
和 SHA*
的常量
public static byte[] digest(File file, String algorithm)
file
- 要加密的文件algorithm
- 加密算法,请参见本类中的名称为 MD*
和 SHA*
的常量
public static KeyGenerator getKeyGenerator(String algorithm)
algorithm
- 加密算法的名称,支持的算法有:
AES、ARCFOUR、Blowfish、DES、DESede、HmacMD5、HmacSHA1、HmacSHA256、HmacSHA384、HmacSHA512、RC2
public static KeyPair getKeyPair(String algorithm, int size)
algorithm
- 算法名称,如:RSA、DSAsize
- 密钥长度,如:512、1024
protected static String getAlgorithmFromTransformation(String transformation)
transformation
-
public static byte[] encrypt(byte[] data, Key key, String transformation)
data
- 要加密的明文数据key
- 密钥transformation
- the name of the transformation, format is "Algorithm/Modes/Paddings", e.g.,
DES/CBC/PKCS5Padding. See Appendix A in the
Java Cryptography Architecture Reference Guide for information about standard transformation names.Algorithm Name | Modes | Paddings |
---|---|---|
AES | ECB, CBC, PCBC, CTR, CTS, CFB, CFB8..CFB128, OFB, OFB8..OFB128 | NOPADDING, PKCS5PADDING, ISO10126PADDING |
AESWrap | ECB | NOPADDING |
ARCFOUR | ECB | NOPADDING |
Blowfish, DES, DESede, RC2 | ECB, CBC, PCBC, CTR, CTS, CFB, CFB8..CFB64, OFB, OFB8..OFB64 | NOPADDING, PKCS5PADDING, ISO10126PADDING |
DESedeWrap | CBC | NOPADDING |
PBEWithMD5AndDES, PBEWithMD5AndTripleDES, PBEWithSHA1AndDESede, PBEWithSHA1AndRC2_40 | CBC | PKCS5Padding |
RSA | ECB | NOPADDING, PKCS1PADDING, OAEPWITHMD5ANDMGF1PADDING, OAEPWITHSHA1ANDMGF1PADDING, OAEPWITHSHA-1ANDMGF1PADDING, OAEPWITHSHA-256ANDMGF1PADDING, OAEPWITHSHA-384ANDMGF1PADDING, OAEPWITHSHA-512ANDMGF1PADDING |
public static byte[] decrypt(byte[] data, Key key, String transformation)
data
- 要解密的明文数据key
- 密钥transformation
- the name of the transformation, format is "Algorithm/Modes/Paddings", e.g.,
DES/CBC/PKCS5Padding. See Appendix A in the
Java Cryptography Architecture Reference Guide for information about standard transformation names.Algorithm Name | Modes | Paddings |
---|---|---|
AES | ECB, CBC, PCBC, CTR, CTS, CFB, CFB8..CFB128, OFB, OFB8..OFB128 | NOPADDING, PKCS5PADDING, ISO10126PADDING |
AESWrap | ECB | NOPADDING |
ARCFOUR | ECB | NOPADDING |
Blowfish, DES, DESede, RC2 | ECB, CBC, PCBC, CTR, CTS, CFB, CFB8..CFB64, OFB, OFB8..OFB64 | NOPADDING, PKCS5PADDING, ISO10126PADDING |
DESedeWrap | CBC | NOPADDING |
PBEWithMD5AndDES, PBEWithMD5AndTripleDES, PBEWithSHA1AndDESede, PBEWithSHA1AndRC2_40 | CBC | PKCS5Padding |
RSA | ECB | NOPADDING, PKCS1PADDING, OAEPWITHMD5ANDMGF1PADDING, OAEPWITHSHA1ANDMGF1PADDING, OAEPWITHSHA-1ANDMGF1PADDING, OAEPWITHSHA-256ANDMGF1PADDING, OAEPWITHSHA-384ANDMGF1PADDING, OAEPWITHSHA-512ANDMGF1PADDING |
|
||||||||||
上一个类 下一个类 | 框架 无框架 | |||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |