Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArchiveTimestamp error after upgrade to v1.0.9 #12

Open
sangar82 opened this issue Mar 29, 2022 · 5 comments
Open

ArchiveTimestamp error after upgrade to v1.0.9 #12

sangar82 opened this issue Mar 29, 2022 · 5 comments
Assignees

Comments

@sangar82
Copy link

sangar82 commented Mar 29, 2022

Hi @bseddon !!!

I hope your are fine!!

Thanks for this package again!

Today, I updated from v1.0.0 to v1.0.9 and I get the following error:

[2022-03-29 09:42:51] develop.ERROR: Call to undefined method lyquidity\xmldsig\SignedDocumentResourceInfo::generateDomDocument() {"userId":4,"exception":"[object] (Error(code: 0): Call to undefined method lyquidity\\xmldsig\\SignedDocumentResourceInfo::generateDomDocument() at /var/www/test/laravel/vendor/lyquidity/xml-signer/src/XAdES.php:310)
[stacktrace]
#0 /var/www/test/laravel/vendor/lyquidity/xml-signer/src/XAdES.php(253): lyquidity\\xmldsig\\XAdES::internalTimestamp(Object(lyquidity\\xmldsig\\SignedDocumentResourceInfo), 'addArchiveTimes...', 'http://M...', NULL)
#1 /var/www/test/laravel/app/M/Certifications/XMLUtils.php(110): lyquidity\\xmldsig\\XAdES::archiveTimestamp(Object(lyquidity\\xmldsig\\SignedDocumentResourceInfo), 'http://M...')
#2 /var/www/test/laravel/app/M/Certifications/CertificationService.php(69): App\\M\\Certifications\\XMLUtils->signAndTimpestampWithXADES('/var/www/test...', 'sin')
#3 /var/www/test/laravel/app/Http/Routes/web.php(78): M\\Certifications\\CertificationService->certificateEvidence(Object(Customer), 'sin', Array, 'Email')

Did you changed the way to sign with LTA on XAdES::archiveTimestamp() method??

My code is the following:


        XAdES::signDocument(
            new InputResourceInfo(
                $path_xml, // The source document
                ResourceInfo::file, // The source is a file
                $partes_ruta['dirname'], // The location to save the signed document
                $partes_ruta['filename'], // The name of the file to save the signed document in,
                null,
                false
            ),
            new CertificateResourceInfo( $certData['cert'], ResourceInfo::string | ResourceInfo::pem ),
            new KeyResourceInfo( $certData['pkey'], ResourceInfo::string ),
            new SignatureProductionPlaceV2(
                'City',
                null, // This is V2 only
                'City',
                '28800',
                'ES'
            ),
            new SignerRoleV2(
                'CEO'
            ),
            array(
                'canonicalizationMethod' => XMLSecurityDSig::C14N,
                'addTimestamp' => $tsaURL // Include a timestamp? Can specify an alternative TSA url eg 'http://mytsa.com/'
            )
        );


        XAdES::archiveTimestamp(
            new SignedDocumentResourceInfo(
                $path_xml,
                ResourceInfo::file,
                XAdES::SignatureRootId, // optional id
                $partes_ruta['dirname'],
                $partes_ruta['filename'].".xml",
                XMLSecurityDSig::generateGUID('archive-timestamp-')
            ),
            $tsaURL
        );

Thanks Bill!

@bseddon
Copy link
Owner

bseddon commented Mar 29, 2022

Thanks for the alert. The cause of your issue is that since version 1.0 a function called generateDomDocument has been created from code to open an XML resource so the code can be re-used. This function has been put into InputResourceInfo.php. I can see now this is an error because SignedDocumentResourceInfo does not inherit from InputResourceInfo. Instead it inherits from BaseInputResourceInfo and this is where the new function generateDomDocument should be placed.

I'll look at this issue later and verify that moving the function is the best change to make.

@bseddon
Copy link
Owner

bseddon commented Mar 29, 2022

The code has been updated to move the function generateDomDocument into BaseInputResourceInfo so all input classes are able to call it. My testing shows this change allows an Archive Timestamp to be created. However, this is not a function I use so it is possible it may not work for you. If so, let me know.

At the moment there is no new release package. If you need one, let me know.

@sangar82
Copy link
Author

Thanks @bseddon , I will try soon!

@sangar82
Copy link
Author

Hi @bseddon !!!

Sorry for the delay in answering.

Can you release a new package for add this changes to production?

Thanks!

@bseddon
Copy link
Owner

bseddon commented Jul 12, 2022

Hi, new releases have been created. The dependent repository requester has also been updated and a release created. Composer should handle this update automatically.

Please note that since the modification to address the issue you reported, other changes have been made. I don't think any changes will affect you adversely. The changes are because ETSI has been running a 'plug test' event over the last 10 or so weeks in which XAdES tools can create signatures then validate others to see if validations are consistent. As a result, it became clear the signer would not work with certificates created using an elliptic curve algorithm.

If you find further problems let me know and I'll get on as soon as possible.

@bseddon bseddon self-assigned this Oct 4, 2022
@bseddon bseddon added the enhancement New feature or request label Oct 4, 2022
@bseddon bseddon modified the milestone: Complete prototype Oct 4, 2022
@bseddon bseddon removed the enhancement New feature or request label Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants