public class FileCrypto extends Object
FileCrypto oferece métodos para criptografar e
descriptografar arquivos a partir de uma senha.| Constructor and Description |
|---|
FileCrypto() |
| Modifier and Type | Method and Description |
|---|---|
static String |
decrypt(String password,
byte[] word)
Recupera uma String criptografada.
|
static byte[] |
encrypt(String password,
String word)
Gera uma String criptografada, a partir de uma senha.
|
protected static Cipher |
generateCipher(String password,
int mode)
Gera um objeto Cipher (usado nas operações de criptografia), a partir de
uma senha.
|
static void |
main(String[] args) |
public static void main(String[] args)
protected static Cipher generateCipher(String password, int mode) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidKeySpecException, InvalidAlgorithmParameterException
password - senha utilizada na geração de chave de cripto.mode - define o mode de operação do cipher (criptografar ou
descriptografar)NoSuchAlgorithmException - .NoSuchPaddingException - .InvalidKeyException - .InvalidKeySpecException - .InvalidAlgorithmParameterException - .public static byte[] encrypt(String password, String word) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidKeySpecException, InvalidAlgorithmParameterException, InvalidClassException, NotSerializableException, IllegalBlockSizeException, BadPaddingException
password - - a senha utilizadaword - a String a ser criptografada.NoSuchAlgorithmException - .NoSuchPaddingException - .InvalidKeyException - .InvalidKeySpecException - .InvalidAlgorithmParameterException - .InvalidClassException - .NotSerializableException - .IllegalBlockSizeExceptionBadPaddingExceptionpublic static String decrypt(String password, byte[] word) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidKeySpecException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException, ClassNotFoundException, InvalidClassException, StreamCorruptedException, OptionalDataException, FileNotFoundException
password - - a senha utilizadaword - a String a ser criptografada.NoSuchAlgorithmException - .NoSuchPaddingException - .InvalidKeyException - .InvalidKeySpecException - .InvalidAlgorithmParameterException - .IllegalBlockSizeException - .BadPaddingException - .ClassNotFoundException - .InvalidClassException - .StreamCorruptedException - .OptionalDataException - .FileNotFoundException - .Copyright © 2017. All rights reserved.