Commit 0a69f66c by Pedro Cavaleiro

Code rearranging, Code commenting, renaming methods to logical ones

parent 7a80299d
...@@ -45,7 +45,7 @@ public class Assinatura { ...@@ -45,7 +45,7 @@ public class Assinatura {
* @throws IOException Excepção generica de input / output * @throws IOException Excepção generica de input / output
* @throws SignatureException Excepção de assinatura * @throws SignatureException Excepção de assinatura
*/ */
public void gerarChaves(String inFilePath, String outSignature, String outPK) throws NoSuchAlgorithmException, InvalidKeyException, FileNotFoundException, IOException, SignatureException{ public void assinarFicheiro(String inFilePath, String outSignature, String outPK) throws NoSuchAlgorithmException, InvalidKeyException, FileNotFoundException, IOException, SignatureException{
signature = Signature.getInstance("DSA"); signature = Signature.getInstance("DSA");
KeyPairGenerator kpg = KeyPairGenerator.getInstance("DSA"); KeyPairGenerator kpg = KeyPairGenerator.getInstance("DSA");
SecureRandom secureRan= new SecureRandom(); SecureRandom secureRan= new SecureRandom();
...@@ -95,7 +95,7 @@ public class Assinatura { ...@@ -95,7 +95,7 @@ public class Assinatura {
* @throws FileNotFoundException Excepção para ficheiro não encontrado * @throws FileNotFoundException Excepção para ficheiro não encontrado
* @throws Exception Excepção genérica * @throws Exception Excepção genérica
*/ */
public boolean verificaAssinatura(String inFilePath, String inSignature, String inPK) throws NoSuchAlgorithmException, InvalidKeyException, FileNotFoundException, Exception{ public boolean verificarAssinatura(String inFilePath, String inSignature, String inPK) throws NoSuchAlgorithmException, InvalidKeyException, FileNotFoundException, Exception{
FileInputStream keyfis = new FileInputStream(inPK); FileInputStream keyfis = new FileInputStream(inPK);
byte[] encKey = new byte[keyfis.available()]; byte[] encKey = new byte[keyfis.available()];
......
...@@ -46,7 +46,7 @@ public class Helpers { ...@@ -46,7 +46,7 @@ public class Helpers {
* @return devolve os bytes do ficheiro * @return devolve os bytes do ficheiro
* @throws Exception * @throws Exception
*/ */
public static byte[] umFicheiro(String filePath) throws Exception{ public static byte[] lerFicheiro(String filePath) throws Exception{
File file = new File(filePath); File file = new File(filePath);
byte[] getBytes = new byte[(int) file.length()]; byte[] getBytes = new byte[(int) file.length()];
FileInputStream fsIn = new FileInputStream(file); FileInputStream fsIn = new FileInputStream(file);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment