public static boolean verifySign(String certLoc, String signLoc, String file) throws IOException, GeneralSecurityException{
    	
    	//adapted from http://docs.oracle.com/javase/tutorial/displayCode.html?code=http://docs.oracle.com/javase/tutorial/security/apisign/examples/VerSig.java
    	@SuppressWarnings("resource")
		FileInputStream fis = new FileInputStream(certLoc);
    	ByteArrayInputStream bis = null;

    	byte value[] = new byte[fis.available()];
    	  fis.read(value);
    	  bis = new ByteArrayInputStream(value);
    	  
    	  CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
    	  
    	  X509Certificate cert = (X509Certificate)certFactory.generateCertificate(bis);
    	
    	FileInputStream sigfis = new FileInputStream(signLoc);
    	byte[] sigToVerify = new byte[sigfis.available()]; 
    	sigfis.read(sigToVerify);
    	sigfis.close();
    	
    	Signature sig = Signature.getInstance("SHA1withDSA", "SUN");
    	
    	sig.initVerify(cert.getPublicKey());
    	
    	FileInputStream datafis = new FileInputStream(file);
    	BufferedInputStream bufin = new BufferedInputStream(datafis);

    	byte[] buffer = new byte[1024];
    	int len;
    	while (bufin.available() != 0) {
    	    len = bufin.read(buffer);
    	    sig.update(buffer, 0, len);
    	};

    	bufin.close();
    	
    	boolean verifies = sig.verify(sigToVerify);

    	System.out.println("signature verifies: " + verifies);
		return verifies;
    }