Is it possible to create a 100% cloud service to sign documents with digital certificate?

-1

My idea, well summarized, is to upload a file in the browser, where the browser will ask the user to select the certificate and thus the site will return the signed document.

Li in this topic one way to do with C # and ASP.NET using iTextSharp, which works inside Visual Studio in debug, but when I put it on the server it does not work. Returning the error below:

  

Message: The current session is not interactive. | HResult: -2146233079

I understand that it is because, in my code, it tries to open the certificates that are installed locally on the machine, but I would like to use the client certificate that is accessing the site.

I then tried to use it as described below, since my IIS requires an SSL certificate on the connection to be accessed:

//Recuperar dados do certificado selecionado pelo cliente no handshake
var Certificate = Request.ClientCertificate.Certificate;
X509Certificate2 cert = new X509Certificate2(Certificate);

However, when I use the method to sign the document, passing this certificate as a parameter, the error is returned to me:

  

Message: No private key. | HResult: -2147024809

What makes sense, since the private key should not be shared on the internet.

Anyway, everything I've read so far indicates that I'll have to have at least one plugin installed on the client's computer to get the private key and make the signature.

Is there an alternative? What would be the best way to do it?

    
asked by anonymous 26.01.2018 / 14:50

1 answer

0

I also have the same problem. We were using applets , but this solution is awful for several reasons and the main and most recent is that from the Java 9 platform (SDK and JRE), the #, mainly because browser companies such as Google and Mozilla have decided to discontinue support for plugins.

NPAPI (flash, Java, etc.).

Luckily, there are many JavaScript solutions that can cover the distance between a smartcard on the client computer (or another client device) and the browser. However, the main solution is written in C ++, FireBreath .

You can take a look at W3C's WebCrypto API .

There are recommendations for signing online documents in order to avoid such a signature, because when the browser connects to the smartcard reader, it opens some security holes.

Some approaches to signing documents with the client certificate involve creating native applications that run on the device, not the browser. As an example of DigiCert .

I'm still studying solutions, but I already have a starting point.

    
28.01.2018 / 19:34