1 | <!DOCTYPE html> |
---|
2 | <html lang="es"> |
---|
3 | <head> |
---|
4 | <?php require_once "./url.php" ?> |
---|
5 | |
---|
6 | <!-- Metadata & Essential styles and scripts --> |
---|
7 | <?php require_once "./headEssential.php" ?> |
---|
8 | <?php require_once "./gen_keys.php"; ?> |
---|
9 | |
---|
10 | </head> |
---|
11 | <body> |
---|
12 | |
---|
13 | <!-- Header --> |
---|
14 | <?php require_once "./header.php" ?> |
---|
15 | |
---|
16 | <!-- Navbar --> |
---|
17 | <?php require_once "./navbar.php" ?> |
---|
18 | |
---|
19 | <!-- Main --> |
---|
20 | <main class="container"> |
---|
21 | <div id="operation"> |
---|
22 | <ul id="tabs-operation" class="nav nav-tabs mt-6" data-tabs="tabs"> |
---|
23 | <li class="nav-item d-none"> |
---|
24 | <a class="nav-link" href="<?php returnURL(); ?>">Firmar con token</a> |
---|
25 | </li> |
---|
26 | <li> |
---|
27 | <a class="nav-link active" href="<?php returnURL(); ?>/php/sign.php">Firmar con .p12</a> |
---|
28 | </li> |
---|
29 | <li> |
---|
30 | <a class="nav-link" href="<?php returnURL(); ?>/">Verificar</a> |
---|
31 | </li> |
---|
32 | </ul> |
---|
33 | |
---|
34 | <div id="operation-tab-content" class="tab-content py-4"> |
---|
35 | <input id="pubkey" type="hidden" value=" <?php echo $_SESSION['public_key_pem'] ?>"> |
---|
36 | <section class="container-fluid"> |
---|
37 | <div class="row"> |
---|
38 | <div class="col-12 px-0"> |
---|
39 | <h2 class="text-center py-3 font-weight-bold text-dark"> |
---|
40 | Firmar Electrónicamente <span class="text-primary">PKCS12</span> |
---|
41 | </h2> |
---|
42 | </div> |
---|
43 | </div> |
---|
44 | |
---|
45 | <div class="row"> |
---|
46 | <div class="col-10 offset-1 col-md-8 offset-md-2 pt-4"> |
---|
47 | <form id="form-sign" action="./run_script.php" method="POST" enctype="multipart/form-data"> |
---|
48 | |
---|
49 | <div class="input-group pb-3"> |
---|
50 | <div class="custom-file"> |
---|
51 | <input id="pdf" class="custom-file-input" type="file" name="pdf" accept=".pdf" required |
---|
52 | tabindex="1" /> |
---|
53 | <label class="custom-file-label" for="pdf">Seleccionar PDF</label> |
---|
54 | </div> |
---|
55 | </div> |
---|
56 | |
---|
57 | <div class="input-group pb-3"> |
---|
58 | <div class="custom-file"> |
---|
59 | <input id="pkcs12" class="custom-file-input" type="file" name="pkcs12" accept=".p12" required |
---|
60 | tabindex="2" /> |
---|
61 | <label class="custom-file-label" for="pkcs12">Seleccionar certificado PKCS12</label> |
---|
62 | </div> |
---|
63 | </div> |
---|
64 | |
---|
65 | <div class="form-group"> |
---|
66 | <input id="phasepass" class="form-control" type="password" aria-describedby="passHelp" |
---|
67 | required tabindex="3" placeholder="Contraseña del certificado" /> |
---|
68 | <small id="passHelp" class="form-text text-muted">Esta contraseña no será guardada en el servidor.</small> |
---|
69 | <input id="password" name="password" type="hidden" /> |
---|
70 | </div> |
---|
71 | |
---|
72 | <div class="form-group text-center"> |
---|
73 | <input id="sign-button" class="btn btn-primary btn-block" name="submit" type="submit" value="Firmar" |
---|
74 | tabindex="4" /> |
---|
75 | </div> |
---|
76 | |
---|
77 | </form> |
---|
78 | </div> |
---|
79 | </div> |
---|
80 | |
---|
81 | </section> |
---|
82 | </div> |
---|
83 | </div> |
---|
84 | </main> |
---|
85 | |
---|
86 | <!-- Footer --> |
---|
87 | <?php require_once "./footer.php" ?> |
---|
88 | |
---|
89 | <script src="../js/jsencrypt.min.js"></script> |
---|
90 | <script src="../js/validate.js"></script> |
---|
91 | <script> |
---|
92 | (function() { |
---|
93 | /** |
---|
94 | * Función para encriptar la frase de paso |
---|
95 | */ |
---|
96 | document.getElementById('phasepass').addEventListener('change', function() { |
---|
97 | var encrypt = new JSEncrypt(); |
---|
98 | encrypt.setPublicKey(document.getElementById("pubkey").value); |
---|
99 | document.getElementById("password").value = encrypt.encrypt(this.value); |
---|
100 | }); |
---|
101 | })(); |
---|
102 | |
---|
103 | </script> |
---|
104 | </body> |
---|
105 | </html> |
---|