EldoS | Feel safer!

Software components for data protection, secure storage and transfer

TElXAdESVerifie.Validate method reason values

Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.
#20508
Posted: 06/19/2012 05:04:27
by eblackmo  (Standard support level)
Joined: 05/09/2012
Posts: 24

Code
TElXAdESVerifier xades = new TElXAdESVerifier();
       verifier.XAdESProcessor = xades;

       int reason = -1;
       verifier.XAdESProcessor.Validate(ref reason);


Ok so I call validate and I get back 32 can you point me to the documentation that explains the meaning of the reason value thanks.
#20509
Posted: 06/19/2012 05:12:11
by Vsevolod Ievgiienko (EldoS Corp.)

Thank you for contacting us.

Sorry, but possible values are not documented yet. Here is the list:

Code
  xvrInternalError                            = Integer(1);
  xvrNotSigned                                = Integer(2);
  xvrNoSigningCertificate                     = Integer(4);
  xvrSigningCertificateNotSigned              = Integer(8);
  xvrSigningCertificateIncomplete             = Integer($10);
  xvrSigningCertificateInvalid                = Integer($20);
  xvrIndividualDataObjectsTimestampInvalid    = Integer($10000);
  xvrIndividualDataObjectsTimestampIncomplete = Integer($20000);
  xvrAllDataObjectsTimestampInvalid           = Integer($40000);
  xvrAllDataObjectsTimestampIncomplete        = Integer($80000);
  xvrSignatureTimestampInvalid                = Integer($100000);
  xvrSignatureTimestampIncomplete             = Integer($200000);
  xvrRefsOnlyTimestampInvalid                 = Integer($400000);
  xvrRefsOnlyTimestampIncomplete              = Integer($800000);
  xvrSigAndRefsTimestampInvalid               = Integer($1000000);
  xvrSigAndRefsTimestampIncomplete            = Integer($2000000);
  xvrArchiveTimestampInvalid                  = Integer($4000000);
  xvrArchiveTimestampIncomplete               = Integer($8000000);


So 32 stands for xvrSigningCertificateInvalid.
#20510
Posted: 06/19/2012 05:23:35
by Dmytro Bogatskyy (EldoS Corp.)

Sorry, this method and it results are not documented yet.
Please check XMLBlackbox\AdvancedSigner sample for detailed info.
Here is a method to convert XAdES reasons to a string from this sample:
Code
        public static string XAdESReasonsToString(int reasons)
        {
            string s = "";
            if ((reasons & SBXMLAdESIntf.Unit.xvrNotSigned) > 0)
                s += "Not Signed, ";
            if ((reasons & SBXMLAdESIntf.Unit.xvrNoSigningCertificate) > 0)
                s += "No Signing Certificate, ";
            if ((reasons & SBXMLAdESIntf.Unit.xvrSigningCertificateNotSigned) > 0)
                s += "Signing Certificate Not Signed, ";
            if ((reasons & SBXMLAdESIntf.Unit.xvrSigningCertificateIncomplete) > 0)
                s += "Signing Certificate Incomplete, ";
            if ((reasons & SBXMLAdESIntf.Unit.xvrSigningCertificateInvalid) > 0)
                s += "Signing Certificate Invalid, ";
            if ((reasons & SBXMLAdESIntf.Unit.xvrIndividualDataObjectsTimestampInvalid) > 0)
                s += "Individual Data Objects Timestamp Invalid, ";
            if ((reasons & SBXMLAdESIntf.Unit.xvrIndividualDataObjectsTimestampIncomplete) > 0)
                s += "Individual Data Objects Timestamp Incomplete, ";
            if ((reasons & SBXMLAdESIntf.Unit.xvrAllDataObjectsTimestampInvalid) > 0)
                s += "All Data Objects Timestamp Invalid, ";
            if ((reasons & SBXMLAdESIntf.Unit.xvrAllDataObjectsTimestampIncomplete) > 0)
                s += "All Data Objects Timestamp Incomplete, ";
            if ((reasons & SBXMLAdESIntf.Unit.xvrSignatureTimestampInvalid) > 0)
                s += "Signature Timestamp Invalid, ";
            if ((reasons & SBXMLAdESIntf.Unit.xvrSignatureTimestampIncomplete) > 0)
                s += "Signature Timestamp Incomplete, ";
            if ((reasons & SBXMLAdESIntf.Unit.xvrRefsOnlyTimestampInvalid) > 0)
                s += "References Only Timestamp Invalid, ";
            if ((reasons & SBXMLAdESIntf.Unit.xvrRefsOnlyTimestampIncomplete) > 0)
                s += "References Only Timestamp Incomplete, ";
            if ((reasons & SBXMLAdESIntf.Unit.xvrSigAndRefsTimestampInvalid) > 0)
                s += "Signature And References Timestamp Invalid, ";
            if ((reasons & SBXMLAdESIntf.Unit.xvrSigAndRefsTimestampIncomplete) > 0)
                s += "Signature And References Timestamp Incomplete, ";
            if ((reasons & SBXMLAdESIntf.Unit.xvrArchiveTimestampInvalid) > 0)
                s += "Archive Timestamp Invalid, ";
            if ((reasons & SBXMLAdESIntf.Unit.xvrArchiveTimestampIncomplete) > 0)
                s += "Archive Timestamp Incomplete, ";
            if ((reasons & SBXMLAdESIntf.Unit.xvrInternalError) > 0)
                s += "Internal Error, ";

            if (!string.IsNullOrEmpty(s) && (s.Length > 2))
                return s.Substring(0, s.Length - 2);
            else
                return s;
        }


The error 32 states that signing certificate is invalid.
You can handle XAdESVerifier.OnBeforeCertificateValidate event, to obtain certificate validator instance and enable it logging for detailed info or to change validation options. Also, please see AdvancedSigner sample.
#20511
Posted: 06/19/2012 05:25:59
by eblackmo  (Standard support level)
Joined: 05/09/2012
Posts: 24

Ok thanks guys and thanks for the quick response.
#20512
Posted: 06/19/2012 07:21:34
by eblackmo  (Standard support level)
Joined: 05/09/2012
Posts: 24

what does a reason value of 0 mean?
#20513
Posted: 06/19/2012 07:26:20
by Vsevolod Ievgiienko (EldoS Corp.)

It means nothing i.e. no reason flags set.
#20514
Posted: 06/19/2012 07:46:26
by eblackmo  (Standard support level)
Joined: 05/09/2012
Posts: 24

So does that signify success??
#20516
Posted: 06/19/2012 07:51:23
by Vsevolod Ievgiienko (EldoS Corp.)

Yes its usually equal to 0 in case of success but you should also check Validate method result that can have next values:

TSBXAdESValidity.xsvInvalid
TSBXAdESValidity.xsvIncomplete
TSBXAdESValidity.xsvValid
#20536
Posted: 06/19/2012 23:30:35
by eblackmo  (Standard support level)
Joined: 05/09/2012
Posts: 24

Thanks its looking good. Any idea when the documentation will be updated to include these changes?
#20537
Posted: 06/20/2012 00:04:44
by Eugene Mayevski (EldoS Corp.)

We expect it to be updated in version 10, though docs usually lag behind because due to used technology the work can't be paralleled between tech.writers.


Sincerely yours
Eugene Mayevski
Also by EldoS: Callback File System
Create virtual file systems and disks, expose and manage remote data as if they were files on the local disk.

Reply

Statistics

Topic viewed 1670 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!