Unabled to located the KeyValue node or it has no children
langaro opened this issue Β· comments
Adriano Langaro commented
Hello, thanks for the library π
Unfortunately I got this error:
Unabled to located the KeyValue node or it has no children
My code is:
`$dsig = new XmlDsig\XmlDigitalSignature();
$dsig->setCryptoAlgorithm(XmlDsig\XmlDigitalSignature::RSA_ALGORITHM)
->setDigestMethod(XmlDsig\XmlDigitalSignature::DIGEST_SHA512)
->forceStandalone();
try {
$dsig->loadPrivateKey('certificados_gerados_github/private.pem', 'password');
$dsig->loadPublicKey('certificados_gerados_github/public.pem');
} catch (\UnexpectedValueException $e) {
print_r($e);
exit(1);
}
$fakeXml = new \DOMDocument();
$fakeXml->loadXML(file_get_contents(path to xml file'));
$node = $fakeXml->getElementsByTagName('InfDeclaracaoPrestacaoServico')->item(0);
try {
$dsig->addObject($node, 'object', true);
$dsig->sign();
$dsig->verify();
} catch (\UnexpectedValueException $e) {
print_r($e);
exit(1);
}
var_dump($dsig->getSignedDocument());
`
Any clue?
Jean Carlos larrota Ortega commented
Dear I also receive that error, which may be?