public class Securities extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static org.bouncycastle.crypto.AsymmetricCipherKeyPair |
createACKeyPair()
创建非对称秘钥对
|
static X500PrivateCredential |
createCredential(String name,
PrivateKey key,
X509Certificate cert)
创建凭证
|
static X509Certificate |
createEntity(String subject,
long period,
long serail,
PublicKey entityKey,
PrivateKey caKey,
X509Certificate caCert,
org.bouncycastle.asn1.x509.Extension... extensions)
创建实体证书
|
static X509Certificate |
createIntermediate(String subject,
long period,
long serial,
PublicKey inKey,
PrivateKey caKey,
X509Certificate caCert)
创建中级证书
|
static KeyPair |
createKeyPair()
创建秘钥对
|
static KeyPair |
createKeyPair(String algorithm)
创建秘钥对
|
static KeyPair |
createKeyPair(String algorithm,
int keySize)
创建秘钥对
|
static KeyStore |
createKeyStore(String name,
String password,
Key key,
Certificate... certificates)
创建证书库
|
static KeyStore |
createKeyStore(String algorithm,
String name,
String password,
Key key,
Certificate... certificates)
创建证书库
|
static KeyStore |
createKeyStore(String name,
String password,
String issuer,
long period)
创建证书库
|
static KeyStore |
createKeyStore(String name,
String password,
String issuer,
long period,
KeyPair keyPair)
创建证书库
|
static KeyStore |
createKeyStore(String algorithm,
String name,
String password,
String issuer,
long period)
创建证书库
|
static KeyStore |
createKeyStore(String algorithm,
String name,
String password,
String issuer,
long period,
KeyPair keyPair)
创建证书库
|
static PrivateKey |
createPrivateKey(String algorithm,
KeySpec keySpec)
创建私钥
|
static PublicKey |
createPublicKey(String algorithm,
KeySpec keySpec)
创建公钥
|
static Certificate |
createRoot(String issuer,
long period,
org.bouncycastle.crypto.AsymmetricCipherKeyPair keyPair)
创建根证书
|
static X509Certificate |
createRoot(String issuer,
long period,
long serial,
KeyPair keyPair)
创建根证书(JCA)
|
static SecretKey |
createSecretKey()
创建秘钥
|
static SecretKey |
createSecretKey(byte[] data)
创建秘钥
|
static SecretKey |
createSecretKey(String algorithm)
创建秘钥
|
static SecretKey |
createSecretKey(String algorithm,
byte[] data)
创建秘钥
|
static org.bouncycastle.operator.ContentSigner |
createSigner(org.bouncycastle.crypto.AsymmetricCipherKeyPair keyPair)
创建签名
|
static org.bouncycastle.operator.ContentSigner |
createSigner(PrivateKey key)
创建签名
|
static org.bouncycastle.operator.ContentSigner |
createSigner(String algorithm,
org.bouncycastle.crypto.AsymmetricCipherKeyPair keyPair)
创建签名
|
static org.bouncycastle.operator.ContentSigner |
createSigner(String algorithm,
PrivateKey key)
创建签名
|
static KeyStore |
createSuite(String type,
String root,
String intermediate,
String entity,
char[] password,
String algorithm,
String issuer,
long period)
创建秘钥套件库
|
static X509Certificate |
getCertificate(byte[] data)
创建证书
|
static Certificate |
getCertificate(String path)
获取证书
|
static X509Certificate |
getCertificate(org.bouncycastle.cert.X509CertificateHolder holder)
创建证书
|
static KeyStore |
getKeyStore(String algorithm,
byte[] data,
char[] password)
获取证书库
|
static KeyStore |
getKeyStore(String algorithm,
InputStream stream,
char[] password)
获取证书库
|
static KeyStore |
getKeyStore(String algorithm,
String path,
char[] password)
获取证书库
|
static PrivateKey |
getPrivateKey(KeyStore store,
String name,
String password)
获取私钥
|
static PublicKey |
getPublicKey(Certificate certificate)
获取公钥
|
static byte[] |
toCipher(int mode,
Key key,
byte[] data)
数据密文
|
static byte[] |
toCipher(int mode,
Key key,
byte[] data,
Callable<Void> initializer)
数据密文
|
static byte[] |
toCipher(int mode,
Key key,
String transformation,
byte[] data,
Callable<Void> initializer)
数据密文
|
static byte[] |
toDecrypt(Certificate certificate,
byte[] data)
公钥解密
|
static byte[] |
toDecrypt(Key key,
byte[] data)
数据解密
|
static byte[] |
toDecrypt(Key key,
byte[] data,
Callable<Void> initializer)
数据解密
|
static byte[] |
toDecrypt(KeyStore keyStore,
String name,
String password,
byte[] data)
私钥解密
|
static byte[] |
toDigest(String algorithm,
byte[] data)
消息摘要
|
static byte[] |
toEncrypt(Certificate certificate,
byte[] data)
公钥加密
|
static byte[] |
toEncrypt(Key key,
byte[] data)
数据加密
|
static byte[] |
toEncrypt(Key key,
byte[] data,
Callable<Void> initializer)
数据加密
|
static byte[] |
toEncrypt(KeyStore keyStore,
String name,
byte[] data)
私钥加密
|
static byte[] |
toEncrypt(KeyStore keyStore,
String name,
String password,
byte[] data)
私钥加密
|
static byte[] |
toMac(Key key,
byte[] data)
消息认证
|
static byte[] |
toMac(String algorithm,
byte[] key,
byte[] data)
消息认证
|
static byte[] |
toSign(String algorithm,
PrivateKey key,
byte[] data)
私钥签名
|
static boolean |
toVerify(PublicKey key,
byte[] data,
byte[] sign)
公钥验签
|
public static KeyStore createSuite(String type, String root, String intermediate, String entity, char[] password, String algorithm, String issuer, long period) throws Exception
type - root - intermediate - entity - password - algorithm - issuer - period - Exceptionpublic static KeyStore createKeyStore(String name, String password, String issuer, long period) throws Exception
name - password - issuer - period - Exceptionpublic static KeyStore createKeyStore(String algorithm, String name, String password, String issuer, long period) throws Exception
algorithm - name - password - issuer - period - Exceptionpublic static KeyStore createKeyStore(String name, String password, String issuer, long period, KeyPair keyPair) throws Exception
name - password - issuer - period - keyPair - Exceptionpublic static KeyStore createKeyStore(String algorithm, String name, String password, String issuer, long period, KeyPair keyPair) throws Exception
algorithm - name - password - issuer - period - keyPair - Exceptionpublic static KeyStore createKeyStore(String name, String password, Key key, Certificate... certificates) throws Exception
name - password - key - certificates - Exceptionpublic static KeyStore createKeyStore(String algorithm, String name, String password, Key key, Certificate... certificates) throws Exception
algorithm - name - password - key - certificates - Exceptionpublic static KeyStore getKeyStore(String algorithm, String path, char[] password) throws Exception
algorithm - path - password - Exceptionpublic static KeyStore getKeyStore(String algorithm, byte[] data, char[] password) throws Exception
algorithm - data - password - Exceptionpublic static KeyStore getKeyStore(String algorithm, InputStream stream, char[] password) throws Exception
algorithm - stream - password - Exceptionpublic static X500PrivateCredential createCredential(String name, PrivateKey key, X509Certificate cert)
name - key - cert - public static X509Certificate createRoot(String issuer, long period, long serial, KeyPair keyPair) throws Exception
issuer - period - keyPair - Exceptionpublic static Certificate createRoot(String issuer, long period, org.bouncycastle.crypto.AsymmetricCipherKeyPair keyPair) throws Exception
issuer - period - keyPair - Exceptionpublic static X509Certificate createIntermediate(String subject, long period, long serial, PublicKey inKey, PrivateKey caKey, X509Certificate caCert) throws Exception
subject - period - serial - inKey - caKey - caCert - Exceptionpublic static X509Certificate createEntity(String subject, long period, long serail, PublicKey entityKey, PrivateKey caKey, X509Certificate caCert, org.bouncycastle.asn1.x509.Extension... extensions) throws Exception
subject - period - entityKey - caKey - caCert - extensions - Exceptionpublic static X509Certificate getCertificate(org.bouncycastle.cert.X509CertificateHolder holder) throws Exception
holder - Exceptionpublic static X509Certificate getCertificate(byte[] data) throws Exception
data - Exceptionpublic static Certificate getCertificate(String path) throws Exception
path - Exceptionpublic static PrivateKey getPrivateKey(KeyStore store, String name, String password) throws Exception
store - name - password - Exceptionpublic static PublicKey getPublicKey(Certificate certificate) throws Exception
certificate - Exceptionpublic static PublicKey createPublicKey(String algorithm, KeySpec keySpec) throws Exception
algorithm - keySpec - Exceptionpublic static PrivateKey createPrivateKey(String algorithm, KeySpec keySpec) throws Exception
algorithm - keySpec - Exceptionpublic static SecretKey createSecretKey(String algorithm) throws Exception
algorithm - Exceptionpublic static SecretKey createSecretKey(byte[] data) throws Exception
data - Exceptionpublic static SecretKey createSecretKey(String algorithm, byte[] data) throws Exception
algorithm - data - Exceptionpublic static KeyPair createKeyPair(String algorithm) throws Exception
algorithm - Exceptionpublic static KeyPair createKeyPair(String algorithm, int keySize) throws Exception
algorithm - keySize - Exceptionpublic static org.bouncycastle.crypto.AsymmetricCipherKeyPair createACKeyPair()
public static org.bouncycastle.operator.ContentSigner createSigner(org.bouncycastle.crypto.AsymmetricCipherKeyPair keyPair)
throws Exception
keyPair - Exceptionpublic static org.bouncycastle.operator.ContentSigner createSigner(String algorithm, org.bouncycastle.crypto.AsymmetricCipherKeyPair keyPair) throws Exception
algorithm - keyPair - Exceptionpublic static org.bouncycastle.operator.ContentSigner createSigner(PrivateKey key) throws Exception
key - Exceptionpublic static org.bouncycastle.operator.ContentSigner createSigner(String algorithm, PrivateKey key) throws Exception
algorithm - key - Exceptionpublic static byte[] toEncrypt(Certificate certificate, byte[] data) throws Exception
certificate - data - Exceptionpublic static byte[] toDecrypt(Certificate certificate, byte[] data) throws Exception
data - certificatePath - Exceptionpublic static byte[] toEncrypt(KeyStore keyStore, String name, byte[] data) throws Exception
keyStore - name - data - Exceptionpublic static byte[] toEncrypt(KeyStore keyStore, String name, String password, byte[] data) throws Exception
keyStore - name - password - data - Exceptionpublic static byte[] toDecrypt(KeyStore keyStore, String name, String password, byte[] data) throws Exception
keyStore - name - password - data - Exceptionpublic static byte[] toEncrypt(Key key, byte[] data) throws Exception
key - data - Exceptionpublic static byte[] toEncrypt(Key key, byte[] data, Callable<Void> initializer) throws Exception
key - data - initializer - Exceptionpublic static byte[] toDecrypt(Key key, byte[] data) throws Exception
key - data - Exceptionpublic static byte[] toDecrypt(Key key, byte[] data, Callable<Void> initializer) throws Exception
key - data - initializer - Exceptionpublic static byte[] toCipher(int mode,
Key key,
byte[] data)
throws Exception
mode - key - data - Exceptionpublic static byte[] toCipher(int mode,
Key key,
byte[] data,
Callable<Void> initializer)
throws Exception
mode - key - data - initializer - Exceptionpublic static byte[] toCipher(int mode,
Key key,
String transformation,
byte[] data,
Callable<Void> initializer)
throws Exception
mode - key - transformation - data - initializer - Exceptionpublic static byte[] toMac(String algorithm, byte[] key, byte[] data) throws Exception
algorithm - key - data - Exceptionpublic static byte[] toMac(Key key, byte[] data) throws Exception
key - data - Exceptionpublic static byte[] toDigest(String algorithm, byte[] data) throws Exception
algorithm - data - Exceptionpublic static byte[] toSign(String algorithm, PrivateKey key, byte[] data) throws Exception
algorithm - key - data - ExceptionCopyright © 2024. All rights reserved.