Skip to main content

Obtaining the attributes of a qualified certificate, defined by the Order of the FSB 795

Project description

fsb795
------

fsb795 are tools for working with
Certificates issued in accordance with
requirements of the Order of the Federal Security Service of the Russian Federation of December 27, 2011 No. 795
"On approval of the requirements for the form of a qualified certificate ..."
(http://base.garant.ru/70133464/)

To install the package, execute:
python -m pip install --upgrade fsb795
or
python3 -m pip install --upgrade fsb795

The package select all significant fields,
inherent in a qualified certificate.

In the case of show all the main features of the package. Note that when you create a certificate context,
You can specify both the file name (DER or PEM) and the string containing the certificate in the PEM format.
Example testfsb795.py.

-----

fsb795 это инструменты для работы с
квалифицированными сертификатами, выпускаемыми в соответствии с
требованиями Приказа ФСБ РФ от 27 декабря 2011 г. № 795
«Об утверждении требований к форме квалифицированного сертификата...»
(http://base.garant.ru/70133464/ )

Для установки пакета выпоните:
python -m pip install --upgrade fsb795
или
python3 -m pip install --upgrade fsb795

Пакет позволяет выбирать все значимые поля,
присущие квалифицированному сертификату.

В примере показаны все основные возможности пакета. Отметим, что при создании контекста сертификата,
может выть указано как имя файла, содержащего сертификат в формате DER или PEM, так и строка, содержащая сертификат в PEM-формате.
Пример testfsb795.py.

-------------------- testfsb795.py -------------------------------------

import fsb795
#from unittest import TestCase

certpem = """
-----BEGIN CERTIFICATE-----
MIIG3DCCBougAwIBAgIKE8/KkAAAAAAC4zAIBgYqhQMCAgMwggFKMR4wHAYJKoZI
hvcNAQkBFg9kaXRAbWluc3Z5YXoucnUxCzAJBgNVBAYTAlJVMRwwGgYDVQQIDBM3
NyDQsy4g0JzQvtGB0LrQstCwMRUwEwYDVQQHDAzQnNC+0YHQutCy0LAxPzA9BgNV
BAkMNjEyNTM3NSDQsy4g0JzQvtGB0LrQstCwLCDRg9C7LiDQotCy0LXRgNGB0LrQ
sNGPLCDQtC4gNzEsMCoGA1UECgwj0JzQuNC90LrQvtC80YHQstGP0LfRjCDQoNC+
0YHRgdC40LgxGDAWBgUqhQNkARINMTA0NzcwMjAyNjcwMTEaMBgGCCqFAwOB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print('Context for certificate not create')
exit(-1)
print('=================formatCert================================')
print(c1.formatCert)
print('=================subjectSignTool================================')
res = c1.subjectSignTool()
print (res)
print('=================issuerSignTool================================')
res1 = c1.issuerSignTool()
print (res1[0])
print (res1[1])
print (res1[2])
print (res1[3])
print('=================prettyPrint================================')
res2 = c1.prettyPrint()
#print(res2)
print('=================classUser================================')
res3 = c1.classUser()
print (res3)
print('=================issuerCert================================')
iss, vlad_is = c1.issuerCert()
print ('vlad_is=' + str(vlad_is))
for key in iss.keys():
print (key + '=' + iss[key])
print('=================subjectCert================================')
sub, vlad_sub = c1.subjectCert()
print ('vlad_sub=' + str(vlad_sub))
for key in sub.keys():
print (key + '=' + sub[key])
print('================publicKey=================================')
key_info = c1.publicKey()
print(key_info['curve'])
print(key_info['hash'])
print(key_info['valuepk'])
print('================serialNumber=================================')
print(c1.serialNumber())
print('================validityCert=================================')
valid = c1.validityCert()
print(valid['not_after'])
print(valid['not_before'])
print('================signatureCert=================================')
algosign, value = c1.signatureCert()
print(algosign)
print(value)
print('================KeyUsage=================================')
ku = c1.KeyUsage()
for key in ku:
print (key)
print('================END=================================')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for fsb795, version 1.5.1
Filename, size File type Python version Upload date Hashes
Filename, size fsb795-1.5.1-py3-none-any.whl (15.2 kB) File type Wheel Python version 3.5 Upload date Hashes View
Filename, size fsb795-1.5.1.tar.gz (11.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page