Index: prototipo/index.html
===================================================================
--- prototipo/index.html	(revision 327fd70136b3c8788c1162cbc241aff5115f23a9)
+++ prototipo/index.html	(revision ad582d7e491d86f5e026e6e4773e5a9f86cc9825)
@@ -40,8 +40,8 @@
 
   <!-- ========== Plugins hwcrypto ========= -->
-  <script type="text/javascript" src="static/js/gitversion.js"></script>
-  <script type="text/javascript" src="static/js/hwcrypto-legacy.js"></script>
-  <script type="text/javascript" src="static/js/hwcrypto.js"></script>
-  <script type="text/javascript" src="static/js/hex2base.js"></script>  
+  <script type="text/javascript" src="static/js/hwcrypto/gitversion.js"></script>
+  <script type="text/javascript" src="static/js/hwcrypto/hwcrypto-legacy.js"></script>
+  <script type="text/javascript" src="static/js/hwcrypto/hwcrypto.js"></script>
+  <script type="text/javascript" src="static/js/hwcrypto/hex2base.js"></script>  
 
 </head>
@@ -311,4 +311,5 @@
   <script src="static/js/functions/manejoJsonPDF.js"></script>
   <script src="static/js/functions/firmarDocumentoPdf.js"></script>
+  <script src="static/js/functions/signFunctions.js"></script>
 
 
Index: prototipo/static/js/functions/signFunctions.js
===================================================================
--- prototipo/static/js/functions/signFunctions.js	(revision ad582d7e491d86f5e026e6e4773e5a9f86cc9825)
+++ prototipo/static/js/functions/signFunctions.js	(revision ad582d7e491d86f5e026e6e4773e5a9f86cc9825)
@@ -0,0 +1,127 @@
+<!-- tomado de https://open-eid.github.io/hwcrypto.js/sign.html -->
+
+
+    	function log_text(s) {
+      		var d = document.createElement("div");
+      		d.innerHTML = s;
+      		document.getElementById('log').appendChild(d);
+    	}
+
+    	function debug() {
+    		window.hwcrypto.debug().then(function(response) {log_text("Debug: " + response);});
+    	}
+    	
+    	function sign() {
+    		
+    		alert("sign()");
+    		// Clear log
+	    	document.getElementById('log').innerHTML = '';
+    		// Timestamp
+    		log_text("sign() clicked on " + new Date().toUTCString());
+    		
+    		// Select hash
+    		//var hashtype = $("input[name=hash]:checked").val();
+    		var hashtype = "SHA-256";
+    		
+    		// Set backend if asked
+    		//var backend =  $("input[name=backend]:checked").val()
+    		var backend = "autodetect";
+    		
+    		// get language
+    		var lang = "en";
+    		if (!window.hwcrypto.use(backend)) {
+	      		log_text("Selecting backend failed.");
+    		}
+
+   			var hash = $("#hashvalue").val();
+   			log_text("Signing " + hashtype + ": " + hash);
+    		// debug
+    		window.hwcrypto.debug().then(function(response) {
+      			log_text("Debug: " + response);
+	    		}, function(err) {
+      				log_text("debug() failed: " + err);
+      				return;
+	    		});
+    		// Sign
+	    	window.hwcrypto.getCertificate({lang: lang}).then(function(response) {
+    	  		var cert = response;
+      			log_text("Using certificate:\n" + hexToPem(response.hex));
+      			
+      			
+      			window.hwcrypto.sign(cert, {type: hashtype, hex: hash}, {lang: lang}).then(function(response) {
+	        		log_text("Generated signature:\n" + response.hex.match(/.{1,64}/g).join("\n"));
+    	  			}, function(err) {
+	    	    		log_text("sign() failed: " + err);
+    	  			});
+	    		}, function(err) {
+    	  			log_text("getCertificate() failed: " + err);
+    			}
+	    		
+	    		);
+  		}
+
+	
+
+	function logGetCertificate() {
+		
+		alert("logGetCertificate()");
+		// Clear log
+    	document.getElementById('log').innerHTML = '';
+		// Timestamp
+		log_text("sign() clicked on " + new Date().toUTCString());
+		
+		// Select hash
+		//var hashtype = $("input[name=hash]:checked").val();
+		var hashtype = "SHA-256";
+		
+		// Set backend if asked
+		//var backend =  $("input[name=backend]:checked").val()
+		var backend = "autodetect";
+		
+		// get language
+		var lang = "en";
+		if (!window.hwcrypto.use(backend)) {
+      		log_text("Selecting backend failed.");
+		}
+
+			var hash = $("#hashvalue").val();
+			log_text("Signing " + hashtype + ": " + hash);
+		// debug
+		window.hwcrypto.debug().then(function(response) {
+  			log_text("Debug: " + response);
+    		}, function(err) {
+  				log_text("debug() failed: " + err);
+  				return;
+    		});
+		// Sign
+    	window.hwcrypto.getCertificate({lang: lang}).then(function(response) {
+	  		var cert = response;
+  			log_text("Using certificate:\n" + hexToPem(response.hex));
+    	});
+    }
+	
+	
+	function getCertificate() {
+		
+		alert("getCertificate()");
+		// Clear log
+    	document.getElementById('log').innerHTML = '';
+		// Timestamp
+		log_text("sign() clicked on " + new Date().toUTCString());
+		
+		// Set backend if asked
+		//var backend =  $("input[name=backend]:checked").val()
+		var backend = "autodetect";
+		
+		// get language
+		var lang = "en";
+		if (!window.hwcrypto.use(backend)) {
+      		log_text("Selecting backend failed.");
+		}
+    	window.hwcrypto.getCertificate({lang: lang}).then(function(response) {
+	  		var cert = response;
+  			log_text("Using certificate:\n" + hexToPem(response.hex));
+  			return cert;
+    	});
+    }
+
