1

In our System, we generate PDF documents and we need to sign them using a digital certificate from the user.

How to do that in codenameone? Do you have pieces of knowledge that could share here about this subject (using mobile devices)?

hrugani
  • 457
  • 3
  • 11
  • How do you generate the PDF files? We don't support client side PDF generation at the moment so you aren't using Codename One for that. If you use native code or server code then what are you doing in either one of these cases? – Shai Almog Dec 23 '17 at 05:49
  • I use server-side code to generate PDF file then this PDF file is downloaded and saved in Codename One Storage of the device. The problem is how to sign the document that I already have on my device. – hrugani Dec 23 '17 at 14:35
  • Normally I refer people to native but it seems iOS doesn't support this natively https://stackoverflow.com/questions/19901417/how-to-digitally-sign-a-pdf-using-x-509-certificate-data-from-ios-application I thing @rmhrisk has the right answer but you should do the signing on the server too instead of on the device. Even if you get a Java library it probably needs complex crypto API's that we don't support. Even if you can get around that this will make export settings for your app far more problematic legally – Shai Almog Dec 24 '17 at 05:16

1 Answers1

1

I am not familiar with Code Name One but it seems it allows cross-platform development based on a Java code base. If so it seems probable they will let you call out to third-party Java libraries, as such if you intend to do a signing on the phone you probably want to look at iText's Java library (https://itextpdf.com/). The logic you need does exist in free libraries but if your looking for something turnkey then this is probably the easiest Java solution out there.

The other thing is if you intend to do signing you, of course, need key material to do that signing. It sounds like you want to do signing on each mobile device so you have to decide how you will authenticate each device, what information goes into the certificates and work out how you get those certificates. Most CAs will entertain some sort of agreement for client certificates that you would use for this purpose.

You can, of course, opt to use a service also, one I make is called Hancock (hancock.ink), you would use it in a Web View and just pass it the PDF you want signed and the rest would be taken care of for you.

rmhrisk
  • 1,814
  • 10
  • 16
  • Thank you "rmhrisk" for your answer. All that you've said sounds good and consistent, even you have mentioned that you aren't familiar with Codename One. I'll dedicate time and effort to dive into your answer. Even whether I don't use exactly your answer, in the end, your answer is very useful. Thank you. – hrugani Dec 23 '17 at 14:58