mirror of
https://github.com/internetee/registry.git
synced 2025-07-28 13:36:15 +02:00
fix: improve certificate parsing and file extensions
- Fix PKCS12 container parsing by using consistent password - Add proper file extensions for certificate downloads (.key, .csr, .crt) - Improve private key parsing by removing unnecessary Base64 decoding - Add error logging for certificate parsing failures - Clean up certificate serializer code The main changes include: - Using P12_PASSWORD consistently across generation and parsing - Adding proper file extensions for different certificate types - Fixing private key parsing to handle PEM format correctly - Adding detailed error logging for debugging purposes - Removing redundant code comments and improving code clarity This commit improves the reliability of certificate handling and provides better user experience with correct file extensions.
This commit is contained in:
parent
0925fa4d4b
commit
fe90d787c2
4 changed files with 29 additions and 5 deletions
|
@ -36,7 +36,14 @@ module Repp
|
|||
desc "Download a specific api user's specific certificate"
|
||||
param :type, String, required: true, desc: 'Type of certificate (csr or crt)'
|
||||
def download
|
||||
extension = params[:type] == 'p12' ? 'p12' : 'pem'
|
||||
extension = case params[:type]
|
||||
when 'p12' then 'p12'
|
||||
when 'private_key' then 'key'
|
||||
when 'csr' then 'csr'
|
||||
when 'crt' then 'crt'
|
||||
else 'pem'
|
||||
end
|
||||
|
||||
filename = "#{@api_user.username}_#{Time.zone.today.strftime('%y%m%d')}_portal.#{extension}"
|
||||
|
||||
data = if params[:type] == 'p12' && @certificate.p12.present?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue