feat: improve certificate download extensions

Update certificate download functionality to use appropriate file extensions:
- Use .p12 extension for PKCS#12 files
- Keep .pem extension for PEM-encoded files (CSR, CRT, private key)

This change ensures that downloaded certificate files have the correct extension based on their format, making it easier for users to identify and use the files correctly.
This commit is contained in:
oleghasjanov 2025-02-19 16:07:50 +02:00
parent 51035d1ddf
commit 5355397025
15 changed files with 281 additions and 262 deletions

View file

@ -1,19 +0,0 @@
class CreateUserCertificates < ActiveRecord::Migration[6.1]
def change
create_table :user_certificates do |t|
t.references :user, null: false, foreign_key: true
t.binary :private_key, null: false
t.text :csr
t.text :certificate
t.binary :p12
t.string :status
t.datetime :expires_at
t.datetime :revoked_at
t.string :p12_password_digest
t.timestamps
end
add_index :user_certificates, [:user_id, :status]
end
end

View file

@ -0,0 +1,8 @@
class AddP12FieldsToCertificates < ActiveRecord::Migration[6.1]
def change
add_column :certificates, :private_key, :binary
add_column :certificates, :p12, :binary
add_column :certificates, :p12_password_digest, :string
add_column :certificates, :expires_at, :timestamp
end
end