public class SimpleRSAEncryptionMaterials extends Object implements EncryptionMaterials
Modifier and Type | Field and Description |
---|---|
static String |
KEY_WRAP_ALGORITHM |
Constructor and Description |
---|
SimpleRSAEncryptionMaterials(KeyPair keyPair) |
SimpleRSAEncryptionMaterials(KeyPair keyPair,
Map<String,String> desc) |
Modifier and Type | Method and Description |
---|---|
void |
addKeyPairDescMaterial(KeyPair keyPair,
Map<String,String> description)
Add a key pair and its descrption for decrypting data.
|
void |
decryptCEK(ContentCryptoMaterialRW contentMaterialRW)
Decrypt the encrypted content encryption key(cek) and encrypted iv and put
the result into
ContentCryptoMaterialRW . |
void |
encryptCEK(ContentCryptoMaterialRW contentMaterialRW)
Encrypt the content encryption key(cek) and iv, and put the result into
ContentCryptoMaterialRW . |
static RSAPrivateKey |
getPrivateKeyFromPemPKCS1(String privateKeyStr)
Gets a rsa private key from PKCS1 pem string.
|
static RSAPrivateKey |
getPrivateKeyFromPemPKCS8(String privateKeyStr)
Gets a rsa private key from PKCS8 pem string.
|
static RSAPublicKey |
getPublicKeyFromPemX509(String publicKeyStr)
Gets a rsa public key from PKCS8 pem string.
|
public static final String KEY_WRAP_ALGORITHM
public SimpleRSAEncryptionMaterials(KeyPair keyPair)
public void addKeyPairDescMaterial(KeyPair keyPair, Map<String,String> description)
keyPair
- The RSA key pair.description
- The descripton of encryption materails.public void encryptCEK(ContentCryptoMaterialRW contentMaterialRW)
ContentCryptoMaterialRW
.encryptCEK
in interface EncryptionMaterials
contentMaterialRW
- The materials that contans all content crypto info,
it must be constructed on outside and filled with the iv cek parameters.
Then it will be builed with the encrypted cek ,encrypted iv, key wrap
algorithm and encryption materials description by this method.public void decryptCEK(ContentCryptoMaterialRW contentMaterialRW)
ContentCryptoMaterialRW
.decryptCEK
in interface EncryptionMaterials
contentMaterialRW
- The materials that contans all content crypto info,
it must be constructed on outside and filled with
the encrypted cek ,encrypted iv, key wrap algorithm,
encryption materials description and cek generator
algothrim. Then it will be builded with the cek and iv.public static RSAPrivateKey getPrivateKeyFromPemPKCS1(String privateKeyStr)
public static RSAPrivateKey getPrivateKeyFromPemPKCS8(String privateKeyStr)
public static RSAPublicKey getPublicKeyFromPemX509(String publicKeyStr)
Copyright © 2021. All Rights Reserved.