php – NFe – private and public key reading applet


I need to develop a system to issue electronic invoices. My big problem is that this system needs to meet the A3 certificate (card) and as far as I've been reading with php it's still not possible to capture the private and public key of the card. So I thought of making an applet just to read this data and put it in a session, so I could use it with php.

As I know little about Java, I would like to know if it is possible to do this, or is it my madness. And if it is possible if someone has to indicate me a software where I can look in the source OR readings so that I can develop this.

If I succeed, I propose to post on the NfePHP project and contribute to the community!


I have already implemented NFSe issuance systems whose RPS needed the signature with a digital certificate and the client had just one of the A3 type.

Simple solution : create a little Java program that runs in the terminal (task) to do the signature. It communicates with my PHP application's API for unsigned batches, when it finds one, it signs it and sends the result back to the API.

The API is very simple and only needs 2 access points:

  • one for picking up unsigned lots;
  • another to submit the signature of the processed batches.

Follow this path and you'll do well (or let me know if you find a better solution) 🙂

Another alternative, as said earlier, is to use an A1 type certificate. I know a lot of people who went in that direction.


Scroll to Top