LINUX.ORG.RU
ФорумAdmin

Вопрос по Openssl


0

2
1) Создаю корневой сертификат 
openssl req -x509 -days 1460 -newkey rsa:2048 \
             -keyout strongswanKey.pem -out strongswanCert.pem
2)
оздаём 1024 bit RSA  приватный ключ moonkey.pem и запрос на сертификат mooncert.pem

openssl req -newkey rsa:1024 -keyout moonkey.pem
             -out mooncert.pem

3)
openssl ca -in moonkey.pem -days 730 -out mooncert.pem
            -notext

Получаю 

root@debtest:/# openssl ca -in moonkey.pem -days 730 -out mooncert.pem
Using configuration from /usr/lib/ssl/openssl.cnf
Error opening CA private key ./demoCA/private/cakey.pem
13062:error:02001002:system library:fopen:No such file or directory:bss_file.c:356:fopen('./demoCA/private/cakey.pem','r')
13062:error:20074002:BIO routines:FILE_CTRL:system lib:bss_file.c:358:
unable to load CA private key


Где ошибся ?

★★

Ответ на: комментарий от leave

понял начал поправил openssl.cnf

# echo '01' > serial
touch index.txt
затем 
1) Создаю корневой сертификат 
openssl req -x509 -days 1460 -newkey rsa:2048 \
             -keyout strongswanKey.pem -out strongswanCert.pem
2)
оздаём 1024 bit RSA  приватный ключ moonkey.pem и запрос на сертификат mooncert.pem

openssl req -newkey rsa:1024 -keyout moonkey.pem
             -out mooncert.pem

3)
openssl ca -in moonkey.pem -days 730 -out mooncert.pem
            -notext
получаю 

root@debtest:/1# openssl ca -in moonkey.pem -days 730 -out mooncert.pem -notext
Using configuration from /usr/lib/ssl/openssl.cnf
Enter pass phrase for /1/strongswanKey.pem:
Error reading certificate request in moonkey.pem
1915:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:650:Expecting: CERTIFICATE REQUEST

drac753 ★★
() автор топика
Ответ на: комментарий от drac753

openssl req -newkey rsa:1024 -keyout moonkey.pem -out mooncert.pem

openssl ca -in moonkey.pem -days 730 -out mooncert.pem -notext

У тебя csr и сертификат имеют одно и то же имя.

leave ★★★★★
()
Ответ на: комментарий от leave

сапсиб за подсказку разобрался подписал , собственно вопрос

####################################################################

[ CA_default ]
#Правим это кусок 
dir             = /1            # Где все находится
certs           = $dir          # Где хранятся выпущенные сертификаты 
crl_dir         = $dir          # Где хранится выданый clr
database        = $dir/index.txt        #Индексные файлы базы данных
#unique_subject = no                    # Set to 'no' to allow creation of
                                        # several ctificates with same subject.
new_certs_dir   = $dir/         #Куда помещать новые сертификаты 

certificate     = $dir/strongswanCert.pem       # Где лежит корневой сертификат 
serial          = $dir/serial           # В настоящее время серийный номер 
crlnumber       = $dir  # Текущий crl номер
                                        # must be commented out to leave a V1 CRL
crl             = $dir/crl.pem          # The current CRL
private_key     = $dir/strongswanKey.pem # The private key
RANDFILE        = $dir/private/.rand    # private random number file

подписую запрос на сертификат openssl ca -in moonsrc.pem -days 730 -out mooncert.pem -notext

в /1 появляются

01.pem 
index.txt - base
index.txt.attr
index.txt.old  
mooncert.pem - подпис сертификат
moonkey.pem - ключ
moonsrc.pem - csr
serial - serial
serial.old  
strongswanCert.pem - ca 
strongswanKey.pem -key ca

Что такое 01. pem ?

плюс создание CRL

root@debtest:/1# openssl ca -gencrl -crldays 15 -out crl.pem
Using configuration from /usr/lib/ssl/openssl.cnf
Enter pass phrase for /1/strongswanKey.pem:
unable to load number from /1
error while loading CRL number
4662:error:0D066096:asn1 encoding routines:a2i_ASN1_INTEGER:short line:f_int.c:215:

drac753 ★★
() автор топика
Ответ на: комментарий от drac753

01.pem - это и есть твой сертификат :) ($serial)

leave ★★★★★
()
Ответ на: комментарий от drac753

У тебя есть переменная crlnumber, значение которой выставлено в $dir, т.е. в имя каталога (1). Если ты ее закомментируешь, у тебя будет создан CRL первой версии.

CRL v1 is widely used

But, scalability is an issue, since v1 crl could glow very big

Limitation of extending v1 crl

crl substitution attack could be done with v1 crl

v2 crl solves these problem by introducing the notion of extensions (compared with v3 x509 certificate)

A critical extension should be processed, and understood by related parties.

Non-critical extensions could be ignored

leave ★★★★★
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.