Answer the question
In order to leave comments, you need to log in
Program work with EDS
Good afternoon. I use the Technocad-Express program, which works with an EDS issued by the Technocad CA.
The task is to sign the file with this signature in your program: for a binary file, create filename.sig, which will be its valid digital signature
. In cryptography, I am a complete zero, I don’t know where to start in order to quickly deal with this issue.
What is known about the subject:
1) Programming language: C#
2) Technocad-Express uses the Crypto-PRO program to work with certificates
3) The recipient site uses something like CAPICOM to work with EDS
4) EDS is stored in the registry
5) Exported to EDS flash drive consists of files: header.key masks.key masks2.key name.key primary.key primary2.key
6) Signature standard PKCS#7, DER encoding
7) Information from the documentation: Calculation of hash sums GOST R 34.11-94 www.w3.org/2001/04/xmldsig-more#gostr3411
Signature generation GOST R 34.10-2001 www.w3 .org/2001/04/xmldsig-more#gostr34102001-gostr3411
Exclusive XML Canonicalization from 18 July 2002 www.w3.org/2001/10/xml-exc-c14n#
Downloaded the
BouncyCasle library , trying to figure it out. It's embarrassing that not PKCS # 7 is implemented there, but PKCS # 12, are these standards backwards compatible?
Tell me, please, in which direction should I dig, any sites with examples?
Answer the question
In order to leave comments, you need to log in
Unfortunately I don't know C#, I can share my IronPython function. The procedure, classes and methods will be the same.
from System.Security.Cryptography import Pkcs
from System.Security.Cryptography.X509Certificates import X509Store, OpenFlags, X509Certificate2Collection,\
X509Certificate2, X509Certificate2UI, StoreName
def sign(content, tp):
store = X509Store(StoreName.My)
store.Open(OpenFlags.ReadOnly)
storecollection = X509Certificate2Collection(store.Certificates)
myCert = None
for cert in storecollection:
if cert.Thumbprint.ToLower == tp.ToLower:
myCert = cert
if not myCert:
return None
else:
contentInfo = Pkcs.ContentInfo(content)
signedCms = Pkcs.SignedCms(contentInfo, True)
cmsSigner = Pkcs.CmsSigner(myCert)
signedCms.ComputeSignature(cmsSigner)
sign = signedCms.Encode()
return sign
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question