Class SecuredData
- java.lang.Object
-
- com.academy.stratum.crypto.api.secured.data.SecuredData
-
- All Implemented Interfaces:
java.io.Serializable
public class SecuredData extends java.lang.Object implements java.io.SerializableSecured data container
After encryption you can safely move this object in the insecure networks- Author:
- Ruslan Nazirov
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SecuredData(byte[] data)Init SecuredData from bytes arraySecuredData(java.io.File file)Init SecuredData from file
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddecrypt(java.security.PrivateKey aeaPrivateKey, java.security.PublicKey dsaPublicKey, byte[] macSecretKey)Дешифрование объектаvoidencrypt(java.security.PublicKey aeaPublicKey, java.security.PrivateKey dsaPrivateKey, byte[] macSecretKey, SymmetricEncryptionAlgorithm SEA, AsymmetricEncryptionAlgorithm AEA, DigitalSignatureAlgorithm DSA, MessageAuthenticationCodeAlgorithm MAC)Encrypt objectbyte[]getData()Get data in the current state (encrypted or not, depends on what operations were executed with SecuredData)
-
-
-
Constructor Detail
-
SecuredData
public SecuredData(byte[] data)
Init SecuredData from bytes array- Parameters:
data- Data to encrypt
-
SecuredData
public SecuredData(java.io.File file) throws java.lang.ExceptionInit SecuredData from file- Parameters:
file- File to read data from- Throws:
java.lang.Exception- Error during SecuredData creation
-
-
Method Detail
-
encrypt
public void encrypt(java.security.PublicKey aeaPublicKey, java.security.PrivateKey dsaPrivateKey, byte[] macSecretKey, SymmetricEncryptionAlgorithm SEA, AsymmetricEncryptionAlgorithm AEA, DigitalSignatureAlgorithm DSA, MessageAuthenticationCodeAlgorithm MAC) throws java.lang.ExceptionEncrypt object- Parameters:
aeaPublicKey- Public key for asymmetric encryption algorithmdsaPrivateKey- Private key for digital signature algorithmmacSecretKey- Secret key for message authentication code algorithmSEA- Symmetric encryption algorithmAEA- Asymmetric encryption algorithmDSA- Digital signature algorithmMAC- Message authentication code algorithm- Throws:
java.lang.Exception- Encryption error
-
decrypt
public void decrypt(java.security.PrivateKey aeaPrivateKey, java.security.PublicKey dsaPublicKey, byte[] macSecretKey) throws java.lang.ExceptionДешифрование объекта- Parameters:
aeaPrivateKey- Private key for asymmetric encryption algorithmdsaPublicKey- Public key for digital signature algorithmmacSecretKey- Secret key for message authentication code algorithm- Throws:
java.lang.Exception- Decryption error
-
getData
public byte[] getData()
Get data in the current state (encrypted or not, depends on what operations were executed with SecuredData)- Returns:
- data Data in the current state
-
-