Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Current »

eSeal creation

Scope

Puts organization’s electronic seal on a file.

Description

Creates electronic seal signature using organization’s electronic seal certificate, timestamp using authentication certificate and the revocation data (for example - OCSP). 

Request

The Service provider's application sends the following POST request using TLS:

POST /api-sign/v1.0/eSealCreate 

Authorization

The request must contain an Authorization header with an OAuth Introspect access token obtained via Integration Platform a Service provider's credentials grant flow.

Introspect piekļuves talona (token) saņemšana

Description

This operation obtains an OAuth 2.0 access token. This operation can be invoked as part of an OAuth 2.0 Service provider's credentials grant flow.

Introspect access token

When the Service provider's credentials grant flow is used, the obtained access token demonstrates the administrative authorization of the Service provider's application making the call for accessing certain resources or services (i.e., without direct intervention of the resource's owner), or for accessing resources of the Service provider's application. Token is issued when the authorization server that processes the request is not associated to an identity provider. A token of this type can be used for accessing resources not associated to end-users or to end-user resources of any domain.

This type of access token is used to get access to Signature creation and validation service API's

Request

To obtain the token, the Service provider's application must send a request like the following to authorization server using TLS. This request is sent directly from the Service provider’s application to authorization server and does not go via the browser.

POST /trustedx-authserver/oauth/{as}/token

Parameter

Title

Type

Field

Description

as

path

mandatory

Use "lvrtc-eipsign-as"

Host:

Test environment: eidas-demo.eparaksts.lv

Production: eidas.eparaksts.lv

Content-Type Header

Content-Type: application/x-www-form-urlencoded; charset=UTF-8


In HTTP POST request is necessary to incorporated the following main attribute: Authorization – API access token.

Authorization: Basic <API-Key>

How to generate API Access Key

Before Service provider access Integration platform API, LVRTC shall register Service provider as customer of Integration platform. After signing a contract with LVRTC (Test of Production environment) LVRTC generates Service Provider’s application identifier – (client_id) and shared secret (client_secret), intended for the customer usage.
API Access Key (API Key) is generated from the Service provider’s application identifier (client_id), a secret shared with the platform (client_secret)  on the following basis:

Service provider's application identifier client_id are converted using the UTF-8 character encoding and URL encoding conditions.

(warning)  For example, value "Portāls" conversion result is "port%C4%81ls".

Service provider's application password client_secret is converted by using the UTF-8 character encoding and URL encoding conditions.

(warning)  For example, value "drošība" conversion result is "dro%C5%A1%C4%ABba".

Both values of the previous two steps must be combined with separator colon “:” between them.

(warning)  For example, by using previous examples, the result will be "port%C4%81ls:dro%C5%A1%C4%ABba".

Obtained value must be converted using base 64 encoding without line breaks.

(warning)  For example, values "port%C4%81ls:dro%C5%A1%C4%ABba" conversion result is "CG94ydCVDNCUMWxzOmRybyVDNSVBMSVDNCVBQmJh".

"MIME Tools" tool in "Notepad + +" can be used for this purpose.

API-Key = base64[url_encode(utf8(<client_id>)) ':' url_encode(utf8(<client_secret>))]

Body

The content of the request for Introspect access token (used for access SignAPI service):

Property

Usage

Description

grant_type

mandatory

Must have the client_credentials value .

scopemandatoryMust have the urn:safelayer:eidas:oauth:token:introspect value

Example (Introspect access token)

The following example shows a situation in which the Service provider’s application with the identifier "Portal" and the password "drošība" authority shall transmit the request to the server with the identifier "lvrtc-eips-as":

POST /trustedx-authserver/oauth/lvrtc-eipsign-as/token HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Authorization: Basic CG94ydCVDNCUMWxzOmRybyVDNSVBMSVDNCVBQmJh
Host: eidas-demo.eparaksts.lv
grant_type=client_credentials&
			scope=urn%3Asafelayer%3Aeidas%3Aoauth%3Atoken%3Aintrospect

Response

In response, Integration platform authorization server issues a bearer-type OAuth 2.0 access token and returns it in a JSON structure.

{
"access_token" : {string}, 
"token_type" : "Bearer", 
"expires_in" : {number}
}

Parameter

PropertyDescription
access_token
Access token generated by Authorization server. The token has the characteristics specified in the configuration of the authorization server that processed the request and consists of a random string of the number of bytes specified in the Access token number of random bytes (by default, 32), encoded in hexadecimal.
token_type
Type of access token. Always has the "bearer" value. (Bearer type OAuth 2.0 access token).
expires_in
Lifetime (in seconds) of the access token. The Service provider’s application must perform the access the token authorizes before the token expires. This value can be configured in the Token timeout option of the authorization server (by default, 120 seconds). Once this timeout has expired, the token becomes invalid, and the Service provider’s application must obtain another one if it wants to continue invoking the protected services.

Example

Introspect access token:

HTTP/1.1 200 OK
Content-Type: application/json;charset=utf-8 
Cache-Control: no-store, no-cache, must-revalidate 
Pragma: no-cache
{
 "scope": "urn:safelayer:eidas:oauth:token:introspect",
 "access_token": "dfffb0d7f90bed142464750cacad5e4b9e23f58ecb1d77e3bdf706ba208ad16a",
 "token_type": "Bearer",
 "expires_in": 600
}



Body

{
  "sessions": [
    {
      "sessionId": "string"
    }
  ],
  "signAsPdf": false,
  "createNewEdoc": false,
  "signKey": "string",
  "signKeyPassword": "string",
  "authCertificate": "string"
}


PropertyDescription
sessionId

File processing session identifier

Multiple sessions can be sealed at once

signAsPdf

True - will be signed as PDF

False - will cerate XAdES signature in ASICE container (EDOC).

createNewEdoc

True - Always creates new ASICE container (even if signable file is already a ASICE container - ASICE in the ASICE container);

False - If existing file is ASICE container, new signature will be added within existing ASICE container.
signKey
eSeal certificate key in PFX file format encoded in base64.
signKeyPassword

eSeal certificate key password encrypted with API central authentication certificate (issued by LVRTC) public key encoded in base64

RSA Encryption with SHA1 padding

authCertificate
Authentication certificate related to eSeal for Timestamp request in PEM format

Key shall be provided in "pfx" format

Encription

byte[] signKeyPasswordBytes = Encoding.UTF8.GetBytes(req.SignKeyPassword);
byte[] signKeyPasswordBytesEncrypted = publicKey.Encrypt(signKeyPasswordBytes, RSAEncryptionPadding.Pkcs1);
req.SignKeyPassword = Convert.ToBase64String(signKeyPasswordBytesEncrypted);

Example

POST /api-sign/v1.0/eSealCreate  HTTP/1.1
Authorization: Bearer a477b3a3366768c07e4c458f518711b4b351e8d2c2f0f78a1524e4d3efd00603
Host: signapi-prep.eparaksts.lv
{
  "sessions": [
     {
        "sessionId": "702e9106e3fe2987d04a0bf7d585050477c1c0dce4d5b76fafc1178b537bc891"
     }
  ],
  "signAsPdf": false,
  "createNewEdoc": false,
  "signKey": "gbfb43564/70OeyYmqoLJ+YAU1kl+vwGVHT0L+ywky80EO8qx/kMZ7hq1Rm9p/SjzexaS0lIH4yf0OJ74BdZCRGaeBfjZWHiQxBdQSXyeuCqDg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vpSnBPeWy+K/dhfGPyLKKLH/xJrU7FZ0VHTjOtbTIvXorVMX5Ab0aWqv+xOuemKPFD5nzMCBUudXJan0a22RfbWaLm0NUvb/Oz+BN+NcRNc8wKs1Jr3asxNh5F7gxzqMHrxoK6zqCHRvUHPwlwYrGeu3j2vGgE5zinSQi9dBCSsFu7YEh2XZT1r7/4kMjolWX7wSafqO/Zuj/15LNLmsaOIwgDoOfu0VL/WyjN6mWZyJ9RNG9uBYFJSX+jOpAU6g1eIU7cdKydPMCyTjvGSMvfGZ2/3J1ggvdQm7uO93PJyu9V/D5raLXm4tPnIng9/VRc8SSdFcdks4PjUoKew=="}

Response

JSON object:

{
    "results": "string"[
        {
            "sessionId": "string",
            "error": {
                "code": "string",
                "message": "string"
            }
        }
    ]
}
PropertyDescription
results
Signing results: success if error == null or omitted
results.sessionId
File processing session identifier
results.error
Session error if any
results.error.code
Session error code
results.error.message
Session error message

Example

{
  "data": {
	 "results": [
		{
		   "sessionId": "76fa04d8e5e2451b867af6ae667558395459fb9d082d31dadb9f22222f80a3d2"
		}
	 ]
  }
}



  • No labels