P7b сертификат как установить
Перейти к содержимому

P7b сертификат как установить

  • автор:

Install a trusted P7B certificate on Apache

I have received a p7b file from a bank which should be a signed certificate, as a response to a csr file that I have sent.

I have manged to extract a pem certificate with the following command:

The certificate.crt file that I extracted has the following structure:

I am not an expert on SSL, but I assume that this is a certificate chain, since it has two certificates.

I have configured apache with the following directives:

Apache serves this properly on https, but the browser does not recognize this as a signed certificate, and gives me that Untrusted connection screen.

Am I doing something wrong, or the certificate is not signed by a trusted authority. Is there a way to check if the certificate is signed properly?

Importing the certificate chain or a p7b certificate into IBM Resilient

If you obtain the intermediate certificate and root certificate with the server certificate from your certificate authority (CA), or if you obtain a p7b file from your CA, you can follow the following procedure to import the certificate to IBM Resilient.

1. Convert the certificate to a PEM certificate using one of the following ways based on what you have:

a. If you receive a PKCS7 file (.p7b file) encoded with DER which contains the certificate chain, run command:

b. If you receive a PKCS7 file (.p7b file) encoded with PEM which contains the certificate chain, run command:

c. If you receive the server certificate, intermediate certificate and root certificate separately in PEM format, run command:

d. If you receive the server certificate, intermediate certificate and root certificate separately in DER format, you need to convert them to PEM format and follow the above point C to create the chain certificate. The commands are:

2. Open the new generated «chain_cert.pem» by a text editor and delete everything outside ——BEGIN CERTIFICATE—— and ——END CERTIFICATE—— boundaries (keep only the encoded content within the boundaries, the certificates themselves) and save it.
The format of the «chain_cert.pem» file will look like:

3. Import the certificate by command:

4. Verify the certificate is available in keystore by command:

5. Restart Resilient service:

If you are on Resilient v32 or a higher version, you also need to restart resilient-messaging service:

How to install cer and p7b certificates to use in IIS?

I have generated the CSR request on our windows server ( we need to bind our application hosted on this server for Https) using below commands in keytool:

After this I got one csr and and keystore files, which I forwarded for issuing SSL. The team gave me a zip files as the certificate ( containing one .cer and one .p7b file). Now I am not sure how to use these two files in IIS.

What we have tried so far:

  • Imported the .cer in IIS using Complete Certificate Request option, but the certificate disappears from IIS when we check again.
  • Imported the .p7b in IIS using Complete Certificate Request option, but the certificate disappears in this case also.
  • Imported the .cer in certificate store in personal certificate, but it does not appear in IIS settings.
  • Imported the .p7b in certificate store in intermediate certificates, but it does not appear in IIS settings.
  • Imported the .cer in certificate store in personal certificate and .p7b file in intermediate certificates, but no certificate appears in IIS settings.
  • Tried to export the certificate in PFX format from certificate store, but while export, the pfx option is greyed out.

2 Answers 2

Windows has it’s own tool for creating certificate requests. You can use the rather clumsy certreq or the much easier Management Console (Add Certificates plugin for the Computer account on Server 2008R2 and earlier, or run certlm.msc on Server 2012 and later).

In addition to the certificate returned from the CA, you also need the private key installed on the end-entity. In your case, that private key is within the keystore you used when running keytool and therefore inaccessible to Windows.

You have two options:

  • Import the new certificate into the keystore and export both it and the private key as a PKCS#12 ( .pfx ), which you can then import into Windows.
  • Use the Microsoft tool to generate a new request and have that signed by your CA. When you import the returned certificate into Windows it’ll match up with its private key and you can use it in IIS.

If this is an internal CA, I’d go for the latter option. However, an external CA may charge you for another certificate, so you need to decide what is the most cost effective resolution.

If you decide to go with the former and import the newly signed certificate to your keystore, use something like:

Then convert the keystore to a PKCS#12, which you can import to Windows, with:

You will need Java 8 or later to run the command above.

Any intermediate certificates should also be sent to you. That’s probably what is in the p7b file (although you haven’t stated it’s contents). They should be imported into Windows’ Intermediate Certification Authorities store, which you seem to have done already.

Once you have your *.pfx file import it into the server’s Local Machine certificate store (don’t waste time with the IIS MMC snap-in).

P7b сертификат как установить

сертификатыцб2.png

Хранилище текущего пользователя.

Далее выбирается папка в системе, куда его нужно поместить:

выбор хранилища.png
Остается нажать кнопку Готово. Так сертификат будет установлен.


2. Установка сертификата из архива p7b.

Часто возникает необходимость установить сертификаты других пользователей к себе в программу. На примере сертификата Центрального Банка рассмотрим установку из архива.

Из личного кабинета ЦБ скачивается архив с сертификатами, файл называется CBR_11.01.2023_all.p7b.rar. Для начала его нужно распаковать стандартным архиватором.

По файлу нажать правой кнопкой мышки, выбрать в контекстном меню архиватор, и далее выбрать Распаковать в CBR_11.01.2023_all.p7b.

Screenshot_240.png

Извлеченный архив будет выглядеть как папка с расширением p7b.

Screenshot_241.png

Двойным кликом левой клавиши мышки можно открыть папку, в ней находятся все сертификаты пути сертификации для Центрального Банка.

Screenshot_245.png

По нажатию левой клавиши мышки по данному файлу откроется хранилище, которое содержит в себе 3 сертификата — корневой сертификат Минкомсвязи, промежуточный сертификат Центрального банка и сертификат конечный, который предназначен для шифрования.

сертификатыцб.png

Теперь для установки нужно поочередно выбирать каждый из сертификатов. Начать можно с любого. Установить необходимо все. Это нужно для построения правильной цепочки сертификации.

Открыть сертификат Минкомсвязи двойным кликом левой клавиши мышки. Нажать в меню сертификата Установить сертификат. Откроется стандартный мастер установки сертификатов.

Выбрать хранилище Текущего пользователя и нажать Далее.

сертификатыцб2.png

Выбрать вариант установки Поместить все сертификаты в следующее хранилище.

Нажать кнопку Обзор и для сертификата Минкомсвязи выбрать папку Доверенные корневые центры сертификации, нажать кнопку ОК.

Вероятно появление уведомления, здесь необходимо согласиться и нажать Да:

Далее завершить установку кнопкой Готово.

Теперь в папке выберем сертификат с именем Центральный банк, выданный Минкомсвязью. Точно также открыть его можно дважды щелкнув левой клавишей мышки, Установить сертификат, выбрать хранилище Текущего пользователя, выбрать Поместить все сертификаты в следующее хранилище, кнопкой Обзор выбрать хранилище Промежуточные центры сертификации.

Сертификат с именем ЦЕНТРАЛЬНЫЙ БАНК РОССИЙСКОЙ ФЕДЕРАЦИИ, выпущенный Центральным банком, таким же способом устанавливается в папку Другие пользователи.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *