mirror of
https://github.com/internetee/registry.git
synced 2025-08-01 07:26:22 +02:00
change to standard algorithm
This commit is contained in:
parent
1d853b5da9
commit
4343c9f207
1 changed files with 5 additions and 27 deletions
|
@ -217,50 +217,28 @@ module Certificates
|
||||||
Rails.logger.info("Certificate Subject: #{cert.subject}")
|
Rails.logger.info("Certificate Subject: #{cert.subject}")
|
||||||
Rails.logger.info("Certificate Issuer: #{cert.issuer}")
|
Rails.logger.info("Certificate Issuer: #{cert.issuer}")
|
||||||
|
|
||||||
# Используем стандартные алгоритмы для максимальной совместимости
|
|
||||||
# p12 = OpenSSL::PKCS12.create(
|
|
||||||
# # "changeit", # Стандартный пароль для Java keystore
|
|
||||||
# "",
|
|
||||||
# "#{username}",
|
|
||||||
# key,
|
|
||||||
# cert,
|
|
||||||
# [ca_cert]
|
|
||||||
# )
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
# Используем стандартные алгоритмы для максимальной совместимости
|
||||||
p12 = OpenSSL::PKCS12.create(
|
p12 = OpenSSL::PKCS12.create(
|
||||||
'123456', # Используем пароль '123456'
|
'123456', # Оставляем тот же пароль
|
||||||
username,
|
username,
|
||||||
key,
|
key,
|
||||||
cert,
|
cert,
|
||||||
[ca_cert],
|
[ca_cert]
|
||||||
"PBE-SHA1-3DES",
|
# Убираем явное указание алгоритмов и итераций
|
||||||
"PBE-SHA1-3DES",
|
|
||||||
2048,
|
|
||||||
2048 # Увеличиваем mac_iter до 2048 для совместимости
|
|
||||||
)
|
)
|
||||||
rescue => e
|
rescue => e
|
||||||
Rails.logger.error("Error creating PKCS12: #{e.message}")
|
Rails.logger.error("Error creating PKCS12: #{e.message}")
|
||||||
raise
|
raise
|
||||||
end
|
end
|
||||||
|
|
||||||
# # Преобразуем PKCS12 объект в бинарные данные
|
|
||||||
# p12_data = p12.to_der
|
|
||||||
|
|
||||||
# # Сохраняем копию для отладки
|
|
||||||
# pkcs12_path = CERTS_PATH.join(USER_P12_NAME)
|
|
||||||
# File.open(pkcs12_path, 'wb') do |file|
|
|
||||||
# file.write(p12_data)
|
|
||||||
# end
|
|
||||||
|
|
||||||
File.open(CERTS_PATH.join(USER_P12_NAME), 'wb') do |file|
|
File.open(CERTS_PATH.join(USER_P12_NAME), 'wb') do |file|
|
||||||
file.write(p12.to_der)
|
file.write(p12.to_der)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Rails.logger.info("Created PKCS12 with standard algorithms (size: #{p12_data.bytesize} bytes)")
|
Rails.logger.info("Created PKCS12 with standard algorithms (size: #{p12.to_der.bytesize} bytes)")
|
||||||
|
|
||||||
# Возвращаем бинарные данные
|
# Возвращаем бинарные данные
|
||||||
# p12_data
|
|
||||||
p12.to_der
|
p12.to_der
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue