Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to sign XML file with XAdES-BES

Status
Not open for further replies.

darjo

Programmer
May 6, 2013
3
SI
I'm trying to digitally sign an XML document with XAdES-BES with XMLDSig standard in Visual FoxPro. I tryed to do this with Chillkat library, but got stuck at just looking at the certificates in the userstore. Can someone give me a few pointers on how to do this? I couldn't find anything on Google, I even tryed other languages. There are just some examples for PHP and .NET which I can't use.

This is the code for Chillkat:

[pre]ccs=CreateObject('Chilkat_9_5_0.CreateCS')
loCertStore=ccs.OpenCurrentUserStore()
lnNumCerts=loCertStore.NumCertificates

? "User has " + STR(lnNumCerts) + " certificates"

FOR i=0 TO lnNumCerts-1
loCert=loCertStore.GetCertificate(i)
IF !(ISNULL(loCert))
? STR(i) + ": (Common Name) " + loCert.SubjectCN
? STR(i) + ": (Serial Number) " + loCert.SerialNumber
? STR(i) + ": (Issuer) " + loCert.IssuerO
? STR(i) + ": (Issuer) " + loCert.IssuerOU
? STR(i) + ": (Valid from) " + DTOC(TTOD(loCert.ValidFrom))+' to '+DTOC(TTOD(loCert.ValidTo))
RELEASE loCert
ENDIF
?
NEXT[/pre]

What is the next step? Must I use some other library?
 
Not familar with XAdES-BES.

What you're doing is just listing certificates of the user certificate store.
To sign something with a certificate, the certificate must be installed first, that's for sure, but it'll depend on the nature of the signing, whether this needs to go in the user certificate store, or machine or even into some browsers certificate store.

Do you have any non language specific instructions at least?
What are you trying to do explained on a higher level, your going directly into a detail we can't even see whether you've already gone a way on the wrong route from where you initially started.

Bye, Olaf.
 
@OlafDoschke:

So there is a new law in Slovenia that we have to create a digitally signed XML document for all invoices that you send to the goverment. I don't have any experience in this field so I'm asking for help.

All the certificates are installed in the certificate store (userstore).

As I understand, digitally signing is same for all XML documents so surely there is a library that does just that.

@MikeLewis:

The code runs just fine, I was just trying to show an example. Apparently Chillkat is not an option because it doesn't support XMLDsig. I'm just wondering if there is a library that does. I've looked at MSXML but it was meant for Microsoft Office only or something.
 
I've looked at MSXML but it was meant for Microsoft Office only or something.

Um, no. Heck, VFP uses it internally.

It isn't an encryption tool, that's true. But that doesn't have anything to with MS Office.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top