open-eid / digidoc4j

DigiDoc for Java. Javadoc:
http://open-eid.github.io/digidoc4j
GNU Lesser General Public License v2.1
73 stars 39 forks source link

Samples how to add signatures via Mobile-id #9

Closed llyys closed 8 years ago

llyys commented 8 years ago

Is there any sampes how to use Digidoc4j to add signatures via Mobile-id https://digidocservice.sk.ee and via test service https://tsp.demo.sk.ee

rvillido commented 8 years ago

Hi,

There is a small guide on Mobile-ID in our Q&A section https://github.com/open-eid/digidoc4j/wiki/Questions-&-Answers#how-to-sign-with-estonian-mobile-id

Here is a guide to use a test environment https://github.com/open-eid/digidoc4j/wiki/Using-test-TSL-lists

More general examples can be seen here https://github.com/open-eid/digidoc4j/wiki/Examples-of-using-it

And the most detailed documentation is here http://open-eid.github.io/digidoc4j/

I hope it helps. Let us know if you have more questions. Rainer

llyys commented 8 years ago

Hi!

This sence sample is not very helpful

byte[] signatureValue = signDigestSomewhereRemotely(digestToSign, DigestAlgorithm.SHA256);

Since digidocservice.sk.ee after successful signing will return signature as XML format <asic:XAdESSignatures ...

Is there any code to show how should this soap xml response value correctly serialized to byte[]

martinpaljak commented 8 years ago

You can get the "raw" signature with a method that I can't find the documentation for but what can surely be provided to you by the DDS service provider

kristiu commented 8 years ago

DigiDocService's MobileSignHashRequest (that enables to sign the "digestToSign" value in the sample) should be used instead of MobileCreateSignature. This information is also mentioned in https://github.com/open-eid/digidoc4j/wiki/Questions-&-Answers#how-to-sign-with-estonian-mobile-id More details are in DigiDocService doc: http://www.sk.ee/upload/files/DigiDocService_spec_eng.pdf