public class CriyptographyImpl extends Object implements Cryptography
| Constructor and Description |
|---|
CriyptographyImpl() |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
cipher(byte[] content)
Method that encrypts a content passed in the parameter as a byte[]
It uses the algorithm set by the method setAlgorithm()
If you have been informed of a provider, it will also be used.
|
byte[] |
decipher(byte[] content)
Method that decrypts a content passed in the parameter as a byte[]
It uses the algorithm set by the method setAlgorithm ()
If you have been informed of a provider, it will also be used.
|
Key |
generateKey()
Method that generates a cryptographic key using the algorithm set by the setAlgorithm() method
If a provider has been informed, it will also be used to generate the key.
|
void |
setAlgorithm(AsymmetricAlgorithmEnum algorithm)
Changes the algorithm and settings for asymmetric cryptography to be used.
|
void |
setAlgorithm(String algorithm)
Changes only the encryption algorithm to be used.
|
void |
setAlgorithm(SymmetricAlgorithmEnum algorithm)
Changes the algorithm and symmetric encryption settings to be used.
|
void |
setKey(Key key)
A cryptographic key is required to perform encryption.
|
void |
setKeyAlgorithm(String keyAlgorithm)
Alters only the key of the algorithm to be used
|
void |
setProvider(Provider provider)
Changes the encryption provider to be used.
|
void |
setSize(int size)
Change the size of the key if it is necessary to generate the key.
|
public void setAlgorithm(String algorithm)
CryptographysetAlgorithm in interface Cryptographyalgorithm - algorithm namepublic void setAlgorithm(SymmetricAlgorithmEnum algorithm)
CryptographysetAlgorithm in interface Cryptographyalgorithm - algorithm representationSymmetricAlgorithmEnumpublic void setAlgorithm(AsymmetricAlgorithmEnum algorithm)
CryptographysetAlgorithm in interface Cryptographyalgorithm - algorithm representationAsymmetricAlgorithmEnumpublic void setProvider(Provider provider)
CryptographysetProvider in interface Cryptographyprovider - new providerSunJCEpublic void setSize(int size)
CryptographysetSize in interface Cryptographysize - key sizepublic void setKeyAlgorithm(String keyAlgorithm)
CryptographysetKeyAlgorithm in interface CryptographykeyAlgorithm - algorithm namepublic void setKey(Key key)
CryptographySecretKey
Asymmetric encryption uses PublicKey and PrivateKeysetKey in interface Cryptographykey - keypublic Key generateKey()
SecretKeygenerateKey in interface Cryptographypublic byte[] cipher(byte[] content)
cipher in interface Cryptographycontent - content to be cipheredpublic byte[] decipher(byte[] content)
decipher in interface Cryptographycontent - ciphered content to be decryptedCopyright © 2021 SERPRO - Serviço Federal de Processamento de Dados. All rights reserved.