feat: Implement new certificate generation service

- Refactor certificate generation into a dedicated service object
- Add Base64 encoding for p12 binary data storage
- Implement serial number generation and storage
- Remove deprecated certificate generation code
- Simplify certificate status checks
- Update certificate controller to use new generator
- Add proper password handling for p12 containers

The main changes include:
- Moving certificate generation logic to CertificateGenerator service
- Proper handling of binary data encoding
- Implementing serial number tracking for future CRL support
- Removing old certificate generation and validation code
- Simplifying the certificate lifecycle management

This commit provides a more maintainable and robust certificate
generation system while preparing for future CRL implementation.
This commit is contained in:
oleghasjanov 2025-03-13 15:01:17 +02:00
parent d0f247c61c
commit 0925fa4d4b
8 changed files with 104 additions and 453 deletions

View file

@ -0,0 +1,7 @@
class AddSerialAndRevokeStatesToCertificates < ActiveRecord::Migration[6.1]
def change
add_column :certificates, :serial, :string, null: true
add_column :certificates, :revoked_at, :datetime, null: true
add_column :certificates, :revoked_reason, :integer, null: true
end
end

View file

@ -591,7 +591,10 @@ CREATE TABLE public.certificates (
private_key bytea,
p12 bytea,
p12_password_digest character varying,
expires_at timestamp without time zone
expires_at timestamp without time zone,
serial character varying,
revoked_at timestamp without time zone,
revoked_reason integer
);
@ -5723,6 +5726,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20241129095711'),
('20241206085817'),
('20250204094550'),
('20250219102811');
('20250219102811'),
('20250313122119');