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-----

OutUew2hIZv15pJ1QM/VgRO3BTBGDOoIrq8LvgC+3kA=
-----END CERTIFICATE-----
"""

#c1 = fsb795.Certificate('OOO_VOLGA.der')
#c1 = fsb795.Certificate('cert.pem')
c1 = fsb795.Certificate(certpem)
if (c1.pyver == ''):
    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('================IdentificationKind=================================')
idkind = c1.identKind()
print('type identification kind=' + str(idkind))
print('================Private Key Usage Period=================================')
period = c1.keyPeriod()
print('not_before='  + str(period['not_before']))
print('not_after=' + str(period['not_after']))
print('================END=================================')

