| 程序包 | 说明 |
|---|---|
| cn.ponfee.commons.jce.implementation |
The crypto implementation by self, include digest, rsa and ecc
|
| cn.ponfee.commons.jce.implementation.ecc |
ECC implementation
|
| cn.ponfee.commons.jce.implementation.rsa |
RSA implementation
|
| 限定符和类型 | 方法和说明 |
|---|---|
abstract Key |
Cryptor.generateKey()
generate cryptor key
|
Key |
NoopCryptor.generateKey() |
Key |
Key.getPublic() |
Key |
Key.readKey(InputStream in) |
| 限定符和类型 | 方法和说明 |
|---|---|
abstract byte[] |
Cryptor.decrypt(byte[] cipher,
Key dk)
decrypt the cipher use decrypt key
|
byte[] |
NoopCryptor.decrypt(byte[] cipher,
Key dk) |
abstract byte[] |
Cryptor.encrypt(byte[] original,
int length,
Key ek)
encrypt original data in length byte
|
byte[] |
NoopCryptor.encrypt(byte[] input,
int length,
Key ek) |
byte[] |
Cryptor.encrypt(byte[] original,
Key ek) |
| 限定符和类型 | 类和说明 |
|---|---|
class |
ECKey
This is Elliptic Curve key
|
| 限定符和类型 | 方法和说明 |
|---|---|
Key |
ECCryptor.generateKey()
generate ECKey
|
Key |
ECKey.getPublic()
get the public key
|
Key |
ECKey.readKey(InputStream in) |
| 限定符和类型 | 方法和说明 |
|---|---|
byte[] |
ECCryptor.decrypt(byte[] input,
Key dk) |
byte[] |
ECCryptor.encrypt(byte[] input,
int length,
Key ek)
加密数据逻辑:
origin ≡ origin ⊕ data ⊕ data
|
| 限定符和类型 | 类和说明 |
|---|---|
class |
RSAKey
The RSA Key
https://blog.csdn.net/seccloud/article/details/8188812
https://blog.csdn.net/zntsbkhhh/article/details/109581852
https://www.zhihu.com/question/54779059
(1)选择两个不同的大素数p和q
(2)计算公共模数(n=pq)和欧拉数(eular=(p-1)(q-1))
(3)选择公钥指数e
(4)计算inverse(d)
(5)生成公钥和私钥
公钥KU:
n:两素数p和q的乘积(p和q必须保密)(n为模值)
e:与(p-1)*(q-1)互质(e称为公钥指数)
私钥KR:
n:两素数p和q的乘积(p和q必须保密)(n为模值)
d:满足(d*e) mod ((p-1)*(q-1)) = 1(d称为私钥指数)
加密过程 C=M^e mod n (C为密文)
解密过程 M=C^d mod n (M为明文)
|
| 限定符和类型 | 方法和说明 |
|---|---|
Key |
AbstractRSACryptor.generateKey()
This method generates a new key for the crypto.
|
Key |
AbstractRSACryptor.generateKey(int keySize) |
| 限定符和类型 | 方法和说明 |
|---|---|
byte[] |
RSAHashCryptor.decrypt(byte[] input,
Key dk) |
byte[] |
AbstractRSACryptor.decrypt(byte[] input,
Key dk) |
void |
RSAHashCryptor.decrypt(InputStream input,
Key dk,
OutputStream output) |
void |
AbstractRSACryptor.decrypt(InputStream input,
Key dk,
OutputStream output) |
byte[] |
RSAHashCryptor.encrypt(byte[] input,
int length,
Key ek)
(origin ⊕ passwd) ⊕ passwd = origin
|
byte[] |
AbstractRSACryptor.encrypt(byte[] input,
int length,
Key ek) |
void |
RSAHashCryptor.encrypt(InputStream input,
Key ek,
OutputStream output) |
void |
AbstractRSACryptor.encrypt(InputStream input,
Key ek,
OutputStream output) |
Copyright © 2023. All rights reserved.