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

@ -13,8 +13,7 @@ module Repp
api_user_id = p12_params[:api_user_id]
render_error(I18n.t('errors.messages.not_found'), :not_found) and return if api_user_id.blank?
api_user = current_user.registrar.api_users.find(api_user_id)
certificate = Certificate.generate_for_api_user(api_user: api_user)
certificate = ::Certificates::CertificateGenerator.new(api_user_id: api_user_id).execute
render_success(data: { certificate: certificate })
end