HAERGI

KSeF certificates and tokens in SAP. How to manage them securely?

How to safely manage KSeF certificates and tokens in SAP?

Integration with the National e-Invoicing System (KSeF) requires not only a technical connection to the Ministry of Finance interfaces but also responsible access management to these services. At the core of this issue are two key elements: qualified certificates and KSeF access tokens. Their correct usage, monitoring, and renewal are the foundation of secure and continuous operation with electronic invoices in SAP.

In this article, we present how authorization in KSeF works, what mechanisms for managing certificates and tokens in SAP exist, and what implementation practices HAERGI uses to ensure continuity and security of integration.

Types of authorization in KSeF – overview of mechanisms

The National e-Invoicing System supports two main modes of authorization:

In implementation practice, the use of a token is preferred due to:

Additionally, two certificates provided by KSeF are also needed for the connection: a certificate for encrypting the HTTPS-level connection and a certificate for encrypting the XML data itself.

Certificate management in SAP – STRUST transaction

In the HAERGI solution, certificates used in communication with KSeF are registered in SAP using the standard STRUST transaction. The IT department can

SAP automatically warns of the upcoming certificate expiration – this is crucial to ensure the continuity of invoice sending and receiving processes.

Generating access tokens in the KSeF application


Access tokens are generated in the Ministry of Finance’s Taxpayer Application. Within a single NIP, multiple tokens can be created

The token is saved as a character string and can be:

Secure storage of access data in SAP

HAERGI has implemented a solution that allows for:

Monitoring, alerts, and rotation of certificates/tokens

In the system implemented by HAERGI, the administrator can:

Most common errors and the consequences of ignoring them

Lack of proper authorization leads to:

Typical errors:

Implementation best practices

Proper management of certificates and tokens in the SAP system is a necessary condition for maintaining communication with KSeF. HAERGI’s solution provides full control over the authorization process – from certificate registration to token expiration monitoring

This makes it possible not only to meet legal obligations but also to minimize operational and tax risks.

Implementing procedures and automation in the KSeF access area – up-to-date tokens, verified certificates, continuous alerts – is now the foundation of any responsible ERP integration with the National e-Invoicing System.