cryptography - Generate Data which is signed by a Private Key -


i have data signed private key. how obtain initial data signed? went through many examples using bouncy castle verifying if data signed right private key.

cmssigneddata s = new cmssigneddata(new cmsprocessablebytearray(toverify.getbytes()),contents); signerinformationstore signers = s.getsignerinfos(); signerinformation signerinfo = (signerinformation)signers.getsigners().iterator().next(); boolean result = signerinfo.verify(new jcasimplesignerinfoverifierbuilder().setprovider("bc").build(cert.getpublickey()));  

the cmssigneddata object takes 2 parameters:-

1.toverify - sample string has been signed

2.contents - signed data obtained

the problem have 'contents' me. have generate 'toverify' part validate signature.

how generate 'toverify' string?

you cannot recover data signature. signature small piece of data, it's same size given signature scheme, key , representation. if have signature , public key, can verify signature produced corresponding private key, information alone useful. usually, point of verifying signature validate data authentic. need have data you're validating!


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

jquery - How would i go about shortening this code? And to cancel the previous click on click of new section? -