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 |
---|
48 | id="form-sign" |
---|
49 | action="./run_script.php" |
---|
50 | method="POST" |
---|
51 | enctype="multipart/form-data" |
---|
52 | > |
---|
53 | |
---|
54 | <div class="input-group pb-3"> |
---|
55 | <div class="custom-file"> |
---|
56 | <input |
---|
57 | id="pdf" |
---|
58 | class="custom-file-input" |
---|
59 | type="file" |
---|
60 | name="pdf" |
---|
61 | accept=".pdf" |
---|
62 | required |
---|
63 | tabindex="1" |
---|
64 | onchange="checkFileSize(this)" |
---|
65 | /> |
---|
66 | <label class="custom-file-label" for="pdf"> |
---|
67 | Seleccionar PDF (Tamaño máximo <?php echo $maxFileSize ?>) |
---|
68 | </label> |
---|
69 | </div> |
---|
70 | </div> |
---|
71 | |
---|
72 | <div class="input-group pb-3"> |
---|
73 | <div class="custom-file"> |
---|
74 | <input |
---|
75 | id="pkcs12" |
---|
76 | class="custom-file-input" |
---|
77 | type="file" |
---|
78 | name="pkcs12" |
---|
79 | accept=".p12" |
---|
80 | required |
---|
81 | tabindex="2" |
---|
82 | /> |
---|
83 | <label class="custom-file-label" for="pkcs12"> |
---|
84 | Seleccionar certificado PKCS12 |
---|
85 | </label> |
---|
86 | </div> |
---|
87 | </div> |
---|
88 | |
---|
89 | <div class="form-group"> |
---|
90 | <input |
---|
91 | id="phasepass" |
---|
92 | class="form-control" |
---|
93 | type="password" |
---|
94 | aria-describedby="passHelp" |
---|
95 | required tabindex="3" |
---|
96 | placeholder="Contraseña del certificado" |
---|
97 | /> |
---|
98 | <small id="passHelp" class="form-text text-muted"> |
---|
99 | Esta contraseña no será guardada en el servidor. |
---|
100 | </small> |
---|
101 | <input id="password" name="password" type="hidden" /> |
---|
102 | </div> |
---|
103 | |
---|
104 | <div class="form-group text-center"> |
---|
105 | <input |
---|
106 | id="sign-button" |
---|
107 | class="btn btn-primary btn-block" |
---|
108 | name="submit" |
---|
109 | type="submit" |
---|
110 | value="Firmar" |
---|
111 | tabindex="4" |
---|
112 | /> |
---|
113 | </div> |
---|
114 | |
---|
115 | </form> |
---|
116 | </div> |
---|
117 | </div> |
---|
118 | |
---|
119 | </section> |
---|
120 | </div> |
---|
121 | </div> |
---|
122 | </main> |
---|
123 | |
---|
124 | <!-- Footer --> |
---|
125 | <?php require_once "./footer.php" ?> |
---|
126 | |
---|
127 | <script src="../js/jsencrypt.min.js"></script> |
---|
128 | <script src="../js/validate.js"></script> |
---|
129 | <script> |
---|
130 | (function() { |
---|
131 | /** |
---|
132 | * Función para encriptar la frase de paso |
---|
133 | */ |
---|
134 | document.getElementById('phasepass').addEventListener('change', function() { |
---|
135 | var encrypt = new JSEncrypt(); |
---|
136 | encrypt.setPublicKey(document.getElementById("pubkey").value); |
---|
137 | document.getElementById("password").value = encrypt.encrypt(this.value); |
---|
138 | }); |
---|
139 | })(); |
---|
140 | </script> |
---|
141 | </body> |
---|
142 | </html> |
---|