Ajout export P12
This commit is contained in:
@@ -593,9 +593,12 @@ async fetchSubCAs() {
|
||||
name: data.name,
|
||||
common_name: data.common_name,
|
||||
organization: data.organization,
|
||||
organization_unit: data.organization_unit,
|
||||
country: data.country,
|
||||
province: data.province || '',
|
||||
locality: data.locality || '',
|
||||
street_address: data.street_address || '',
|
||||
postal_code: data.postal_code || '',
|
||||
email: data.email || '',
|
||||
key_size: parseInt(data.key_size) || 4096,
|
||||
valid_years: parseInt(data.valid_years) || 10,
|
||||
@@ -632,6 +635,7 @@ async fetchSubCAs() {
|
||||
name: data.name,
|
||||
common_name: data.common_name,
|
||||
organization: data.organization,
|
||||
organization_unit: data.organization_unit,
|
||||
email: data.email || '',
|
||||
country: data.country,
|
||||
province: data.province || '',
|
||||
@@ -785,10 +789,16 @@ async fetchSubCAs() {
|
||||
<h3>${ca.name}</h3>
|
||||
<p><strong>Common Name:</strong> ${ca.common_name}</p>
|
||||
<p><strong>Organization:</strong> ${ca.organization}</p>
|
||||
<p><strong>Organizational Unit:</strong> ${ca.organization_unit}</p>
|
||||
<p><strong>StreetAddress:</strong> ${ca.street_address}</p>
|
||||
<p><strong>PostalCode:</strong> ${ca.postal_code}</p>
|
||||
<p><strong>Valid From:</strong> ${new Date(ca.valid_from).toLocaleString()}</p>
|
||||
<p><strong>Valid To:</strong> ${new Date(ca.valid_to).toLocaleString()}</p>
|
||||
<p><strong>Serial:</strong> ${ca.serial_number}</p>
|
||||
<button class="btn" onclick="window.open('${this.apiBase}/cas/${id}/download/cert')">Download Certificate</button>
|
||||
<div class="button-group">
|
||||
<button class="btn" onclick="window.open('${this.apiBase}/cas/${id}/download/cert')">Download Certificate</button>
|
||||
<button class="btn" onclick="window.open('${this.apiBase}/cas/${id}/download/key')">Download Private Key</button>
|
||||
</div>
|
||||
`);
|
||||
} catch (error) {
|
||||
this.showError('Failed to load CA details');
|
||||
@@ -804,7 +814,9 @@ async fetchSubCAs() {
|
||||
this.showModal('Sub CA Details', `
|
||||
<h3>${subca.name}</h3>
|
||||
<p><strong>Common Name:</strong> ${subca.common_name}</p>
|
||||
<p><strong>Subject:</strong> ${subca.subject}</p>
|
||||
<p><strong>Organization:</strong> ${subca.organization}</p>
|
||||
<p><strong>Organizational Unit:</strong> ${subca.organization_unit}</p>
|
||||
<p><strong>Valid From:</strong> ${new Date(subca.valid_from).toLocaleString()}</p>
|
||||
<p><strong>Valid To:</strong> ${new Date(subca.valid_to).toLocaleString()}</p>
|
||||
<p><strong>Serial:</strong> ${subca.serial_number}</p>
|
||||
@@ -818,12 +830,15 @@ async fetchSubCAs() {
|
||||
async viewCertificate(id) {
|
||||
try {
|
||||
const response = await fetch(`${this.apiBase}/certificates/${id}`);
|
||||
|
||||
if (!response.ok) throw new Error('Not found');
|
||||
|
||||
const cert = await response.json();
|
||||
this.showModal('Certificate Details', `
|
||||
<h3>${cert.common_name}</h3>
|
||||
<p><strong>Type:</strong> ${cert.type}</p>
|
||||
<p><strong>SANs:</strong> ${cert.dns_names}
|
||||
<p><strong>IP Address:</strong> ${cert.ip_adresses}
|
||||
<p><strong>Valid From:</strong> ${new Date(cert.valid_from).toLocaleString()}</p>
|
||||
<p><strong>Valid To:</strong> ${new Date(cert.valid_to).toLocaleString()}</p>
|
||||
<p><strong>Status:</strong> ${cert.revoked ? 'Revoked' : new Date(cert.valid_to) > new Date() ? 'Valid' : 'Expired'}</p>
|
||||
@@ -831,6 +846,7 @@ async fetchSubCAs() {
|
||||
<div class="button-group">
|
||||
<button class="btn" onclick="window.open('${this.apiBase}/certificates/${id}/download/cert')">Download Certificate</button>
|
||||
<button class="btn" onclick="window.open('${this.apiBase}/certificates/${id}/download/key')">Download Private Key</button>
|
||||
<button class="btn" onclick="window.open('${this.apiBase}/certificates/${id}/download/p12')">Download P12</button>
|
||||
</div>
|
||||
`);
|
||||
} catch (error) {
|
||||
|
||||
@@ -5,41 +5,13 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>PKI Manager</title>
|
||||
<link rel="stylesheet" href="/static/css/style.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
||||
<link rel="stylesheet" href="/static/fontawesome/css/all.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<header>
|
||||
<h1><i class="fas fa-shield-alt"></i> PKI Manager</h1>
|
||||
<h1><i class="fas fa-shield-alt"></i>ZEN6 PKI Manager - WIP</h1>
|
||||
<p>Manage your Certificate Authority infrastructure</p>
|
||||
<div style="margin-bottom: 10px;">
|
||||
<button class="btn" onclick="pki.debugData()" style="background: #38a169;">
|
||||
<i class="fas fa-bug"></i> Debug Data
|
||||
</button>
|
||||
<button onclick="testDropdown()" style="padding: 8px 12px; background: #4CAF50; color: white; border: none; border-radius: 4px; cursor: pointer;">
|
||||
Test Dropdown
|
||||
</button>
|
||||
<script>
|
||||
function testDropdown() {
|
||||
console.log('=== TEST DROPDOWN ===');
|
||||
const dropdown = document.getElementById('issuerCA');
|
||||
console.log('Dropdown:', dropdown);
|
||||
console.log('Parent:', dropdown?.parentElement);
|
||||
console.log('All selects:', document.querySelectorAll('select'));
|
||||
|
||||
// Simuler le remplissage
|
||||
if (dropdown) {
|
||||
dropdown.innerHTML = '';
|
||||
const option = document.createElement('option');
|
||||
option.value = 'test';
|
||||
option.textContent = 'Test Option';
|
||||
dropdown.appendChild(option);
|
||||
console.log('Test option added');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
</div>
|
||||
<nav>
|
||||
<button class="nav-btn" data-tab="dashboard">
|
||||
<i class="fas fa-home"></i> Dashboard
|
||||
@@ -136,13 +108,21 @@
|
||||
<label for="caLocality">Locality/City</label>
|
||||
<input type="text" id="caLocality" name="locality">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="caStreetAddress">StreetAddress/City</label>
|
||||
<input type="text" id="caStreetAddress" name="street_address">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="caPostalCode">PostalCode</label>
|
||||
<input type="text" id="caPostalCode" name="postal_code">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="caEmail">Email</label>
|
||||
<input type="email" id="caEmail" name="email" required>
|
||||
<input type="email" id="caEmail" name="email">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="caKeySize">Key Size</label>
|
||||
<select id="caKeySize" name="key_size" required>
|
||||
<select id="caKeySize" name="key_sizeq" required>
|
||||
<option value="2048">2048 bits</option>
|
||||
<option value="4096" selected>4096 bits</option>
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user