If the v verification fails, the function aborts and raises an error.

extract_proof(x, verify = TRUE, verbose = FALSE)

Arguments

x

filename or URL pointing either to the xml proof or the pdf certificate issued from OriginStamp.

verify

if FALSE, read the root hash from the xml file. If TRUE, verify the root hash using the proof.

verbose

if TRUE, details on the verification will be printed which can help to see where the proof is wrong.

Value

the root hash

Examples

extract_proof(system.file("certificate.Bitcoin.pdf", package = "ROriginStamp"))
#> {xml_document} #> <node type="key" value="5e92ec09501a5d39e251a151f84b5e2228312c445eb23b4e1de6360e27bad54b"> #> [1] <left type="mesh" value="7811e3130908fd2678eb2dd3928d245db7f3ed578c21f2ae ... #> [2] <right type="mesh" value="a62eedb07080ce5a21ad26230bcd50ef37cac8cca43a2f1 ...
extract_proof(system.file("proof.Bitcoin.xml", package = "ROriginStamp"))
#> {xml_document} #> <node value="5e92ec09501a5d39e251a151f84b5e2228312c445eb23b4e1de6360e27bad54b" type="key"> #> [1] <left value="7811e3130908fd2678eb2dd3928d245db7f3ed578c21f2ae4fbe680424dc ... #> [2] <right value="a62eedb07080ce5a21ad26230bcd50ef37cac8cca43a2f1d946db2d1d47 ...
extract_proof(system.file("proof.Bitcoin.xml", package = "ROriginStamp"), cverify = FALSE)
#> Error in extract_proof(system.file("proof.Bitcoin.xml", package = "ROriginStamp"), cverify = FALSE): unused argument (cverify = FALSE)
extract_proof(system.file("proof.faulty.xml", package = "ROriginStamp"))
#> Error in extract_proof(system.file("proof.faulty.xml", package = "ROriginStamp")): #> ################################################################# #> ## ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ## #> ## This is not a valid proof!!! ## #> ## ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ## #> ################################################################# #>
extract_proof(system.file("proof.faulty.xml", package = "ROriginStamp"), verbose = TRUE)
#> key: 5e92ec09501a5d39e251a151f84b5e2228312c445eb23b4e1de6360e27bad54b
#> left : 7811e3130908fd2678eb2dd3928d245db7f3fd578c21f2ae4fbe680424dc735e
#> right: a62eedb07080ce5a21ad26230bcd50ef37cac8cca43a2f1d946db2d1d47e1f94
#> Error in extract_proof(system.file("proof.faulty.xml", package = "ROriginStamp"), verbose = TRUE): #> ################################################################# #> ## ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ## #> ## This is not a valid proof!!! ## #> ## ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION ## #> ################################################################# #>