@prefix : <#> . @prefix log: . @prefix crypto: . @prefix string: . this log:forAll :x , :y , :z , :q . # The rules # Get my file contents, and hash it { log:content [ crypto:md5 :x ] } log:implies { :md5 :x } . # Get my key from a local key file # { log:content :x } log:implies { :Bob :keyPair :x } . # { log:content :x } log:implies { :Bob :pubKey :x } . { :x crypto:keyLength "1024" } log:implies { :Bob :keyPair :x } . { :Bob :keyPair :x . :x crypto:publicKey :y } log:implies { :Bob :pubKey :y } . # Sign the hash of my document with my key { :md5 :x . :Bob :keyPair :y . (:x :y) crypto:sign :z } log:implies { :z a :Signature } . # Verify the signature... once against the file, and once against some junk { :Bob :pubKey :x . :md5 :y . :z a :Signature . (:x :y :z) crypto:verifyBoolean :q } log:implies { :q :shouldBeEqualTo "1" } . { :Bob :pubKey :x . :z a :Signature . (:x "garbage" :z) crypto:verifyBoolean :q } log:implies { :q :shouldBeEqualTo "0" } . { :Bob :pubKey :x . :md5 :y . :z a :Signature . :x crypto:verify (:y :z) } log:implies { :Test a :Pass } . { :Bob :pubKey :x . :z a :Signature . :x crypto:verify ("garbage" :z) } log:implies { :Test a :Fail } . { :Bob :keyPair [ crypto:keyLength :x ] } log:implies { :Bob :keyPairLength :x } . # For purging log:implies a log:Chaff . log:forAll a log:Chaff .