Skip to content
This repository was archived by the owner on Mar 12, 2024. It is now read-only.
/ conlibre Public archive

Con Libre: simple API simulator for gematik Konnektor

License

Notifications You must be signed in to change notification settings

spilikin/conlibre

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Con Libre: simple API simulator for gematik Konnektor

Usage

gradle clean
gradle bootRun

Access ServiceDirectory

Response

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:ConnectorServices xmlns="http://ws.gematik.de/int/version/ProductInformation/v1.1" xmlns:ns2="http://ws.gematik.de/conn/ServiceDirectory/v3.1" xmlns:ns3="http://ws.gematik.de/conn/ServiceInformation/v2.0">
  <ns2:TLSMandatory>false</ns2:TLSMandatory>
  <ns2:ClientAutMandatory>false</ns2:ClientAutMandatory>
  <ns3:ServiceInformation>
    <ns3:Service Name="AuthSignatureService">
      <ns3:Versions>
        <ns3:Version TargetNamespace="http://ws.gematik.de/conn/AuthSignatureService/WSDL/v7.4" Version="7.4.0">
          <ns3:Endpoint Location="http://localhost:8080/soap-api/AuthSignatureService/7.4.0"/> (1)
        </ns3:Version>
      </ns3:Versions>
    </ns3:Service>
    <ns3:Service Name="EventService">
      <ns3:Versions>
        <ns3:Version TargetNamespace="http://ws.gematik.de/conn/EventService/WSDL/v7.2" Version="7.2.0">
          <ns3:Endpoint Location="http://localhost:8080/soap-api/EventService/7.2.0"/>
        </ns3:Version>
      </ns3:Versions>
    </ns3:Service>
    <ns3:Service Name="CardService">
      <ns3:Versions>
        <ns3:Version TargetNamespace="http://ws.gematik.de/conn/CardService/WSDL/v8.1" Version="8.1.1">
          <ns3:Endpoint Location="http://localhost:8080/soap-api/CardService/8.1.1"/>
        </ns3:Version>
      </ns3:Versions>
    </ns3:Service>
    <ns3:Service Name="CardService">
      <ns3:Versions>
        <ns3:Version TargetNamespace="http://ws.gematik.de/conn/CardService/WSDL/v8.1" Version="8.1.2">
          <ns3:Endpoint Location="http://localhost:8080/soap-api/CardService/8.1.2"/>
        </ns3:Version>
      </ns3:Versions>
    </ns3:Service>
  </ns3:ServiceInformation>
</ns2:ConnectorServices>

Get all available Smartcards

Request

URI

Method

POST

HTTP Header SOAPAction

Payload

<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
  <soap-env:Body>
    <ns0:GetCards xmlns:ns0="http://ws.gematik.de/conn/EventService/v7.2" mandant-wide="false">
      <ns1:Context xmlns:ns1="http://ws.gematik.de/conn/ConnectorContext/v2.0">
        <ns2:MandantId xmlns:ns2="http://ws.gematik.de/conn/ConnectorCommon/v5.0">MandantId</ns2:MandantId>
        <ns3:ClientSystemId xmlns:ns3="http://ws.gematik.de/conn/ConnectorCommon/v5.0">ClientSystemId</ns3:ClientSystemId>
        <ns4:WorkplaceId xmlns:ns4="http://ws.gematik.de/conn/ConnectorCommon/v5.0">WorkplaceId</ns4:WorkplaceId>
      </ns1:Context>
    </ns0:GetCards>
  </soap-env:Body>
</soap-env:Envelope>

CURL

curl http://localhost:8080/soap-api/EventService/7.2.0 \
  -X POST \
  --header 'SOAPAction: http://ws.gematik.de/conn/EventService/v7.2#GetCards' \
  --data '<soap-env:Envelope>...'

Response

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <ns3:GetCardsResponse xmlns="http://ws.gematik.de/conn/ConnectorCommon/v5.0" xmlns:ns2="http://ws.gematik.de/conn/ConnectorContext/v2.0" xmlns:ns3="http://ws.gematik.de/conn/EventService/v7.2" xmlns:ns4="http://ws.gematik.de/tel/error/v2.0" xmlns:ns5="http://ws.gematik.de/conn/CardServiceCommon/v2.0" xmlns:ns6="http://ws.gematik.de/conn/CardService/v8.1" xmlns:ns7="http://ws.gematik.de/int/version/ProductInformation/v1.1" xmlns:ns8="http://ws.gematik.de/conn/CardTerminalInfo/v8.0" xmlns:ns9="urn:oasis:names:tc:dss:1.0:core:schema" xmlns:ns10="http://www.w3.org/2000/09/xmldsig#" xmlns:ns11="urn:oasis:names:tc:SAML:1.0:assertion">
      <ns6:Cards>
        <ns6:Card>
          <CardHandle>smc-b_2</CardHandle>
          <ns5:CardType>SMC-B</ns5:CardType>
        </ns6:Card>
        <ns6:Card>
          <CardHandle>smc-b_1</CardHandle>
          <ns5:CardType>SMC-B</ns5:CardType>
        </ns6:Card>
      </ns6:Cards>
    </ns3:GetCardsResponse>
  </soap:Body>
</soap:Envelope>

Verify PIN

Request

URI

Method

POST

HTTP Header SOAPAction

Payload

<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
  <soap-env:Body>
    <ns0:VerifyPin xmlns:ns0="http://ws.gematik.de/conn/CardService/v8.1">
      <ns1:Context xmlns:ns1="http://ws.gematik.de/conn/ConnectorContext/v2.0">
        <ns2:MandantId xmlns:ns2="http://ws.gematik.de/conn/ConnectorCommon/v5.0">MandantId</ns2:MandantId>
        <ns3:ClientSystemId xmlns:ns3="http://ws.gematik.de/conn/ConnectorCommon/v5.0">ClientSystemId</ns3:ClientSystemId>
        <ns4:WorkplaceId xmlns:ns4="http://ws.gematik.de/conn/ConnectorCommon/v5.0">WorkplaceId</ns4:WorkplaceId>
      </ns1:Context>
      <ns5:CardHandle xmlns:ns5="http://ws.gematik.de/conn/ConnectorCommon/v5.0">smc-b_2</ns5:CardHandle>
      <ns6:PinTyp xmlns:ns6="http://ws.gematik.de/conn/CardServiceCommon/v2.0">PIN.SMC</ns6:PinTyp>
    </ns0:VerifyPin>
  </soap-env:Body>
</soap-env:Envelope>

CURL

curl http://localhost:8080/soap-api/CardService/8.1.2 \
  -X POST \
  --header 'SOAPAction: http://ws.gematik.de/conn/CardService/v8.1#VerifyPin' \
  --data '<soap-env:Envelope>...'

Response

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <ns4:VerifyPinResponse xmlns="http://ws.gematik.de/conn/ConnectorCommon/v5.0" xmlns:ns2="http://ws.gematik.de/conn/ConnectorContext/v2.0" xmlns:ns3="http://ws.gematik.de/conn/CardServiceCommon/v2.0" xmlns:ns4="http://ws.gematik.de/conn/CardService/v8.1" xmlns:ns5="http://ws.gematik.de/tel/error/v2.0" xmlns:ns6="urn:oasis:names:tc:dss:1.0:core:schema" xmlns:ns7="http://www.w3.org/2000/09/xmldsig#" xmlns:ns8="http://ws.gematik.de/int/version/ProductInformation/v1.1" xmlns:ns9="urn:oasis:names:tc:SAML:1.0:assertion">
      <Status/>
      <ns3:PinResult>OK</ns3:PinResult>
      <ns3:LeftTries>3</ns3:LeftTries>
    </ns4:VerifyPinResponse>
  </soap:Body>
</soap:Envelope>

Call ExternalAuthenticate to sign 512 bit challenge with RSA

Request

URI

Method

POST

HTTP Header SOAPAction

Payload

<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
  <soap-env:Body>
    <ns0:ExternalAuthenticate xmlns:ns0="http://ws.gematik.de/conn/SignatureService/v7.4">
      <ns1:CardHandle xmlns:ns1="http://ws.gematik.de/conn/ConnectorCommon/v5.0">smc-b_2</ns1:CardHandle>
      <ns2:Context xmlns:ns2="http://ws.gematik.de/conn/ConnectorContext/v2.0">
        <ns3:MandantId xmlns:ns3="http://ws.gematik.de/conn/ConnectorCommon/v5.0">MandantId</ns3:MandantId>
        <ns4:ClientSystemId xmlns:ns4="http://ws.gematik.de/conn/ConnectorCommon/v5.0">ClientSystemId</ns4:ClientSystemId>
        <ns5:WorkplaceId xmlns:ns5="http://ws.gematik.de/conn/ConnectorCommon/v5.0">WorkplaceId</ns5:WorkplaceId>
      </ns2:Context>
      <ns0:OptionalInputs>
        <ns6:SignatureType xmlns:ns6="urn:oasis:names:tc:dss:1.0:core:schema">urn:ietf:rfc:3447</ns6:SignatureType>
        <ns0:SignatureSchemes>RSASSA-PKCS1-v1_5</ns0:SignatureSchemes>
      </ns0:OptionalInputs>
      <ns0:BinaryString>
        <ns7:Base64Data xmlns:ns7="urn:oasis:names:tc:dss:1.0:core:schema">WVdKalpHVm1aMmhwYW10c2JXNXZjSEZ5YzNSMWRuZDRlWHBCUWtORVJVWkhTRWxLUzB4TlRrOVFVVkpUVkZWV1YxaFpXakF4TWpNME5UWTNPRGxoWWc9PQ==</ns7:Base64Data>
      </ns0:BinaryString>
    </ns0:ExternalAuthenticate>
  </soap-env:Body>
</soap-env:Envelope>

CURL

curl http://localhost:8080/soap-api/AuthSignatureService/7.4.0 \
  -X POST \
  --header 'SOAPAction: http://ws.gematik.de/conn/SignatureService/v7.4#ExternalAuthenticate' \
  --data '<soap-env:Envelope>...'

Response

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <ns4:ExternalAuthenticateResponse xmlns="http://ws.gematik.de/conn/ConnectorCommon/v5.0" xmlns:ns2="http://ws.gematik.de/conn/ConnectorContext/v2.0" xmlns:ns3="urn:oasis:names:tc:dss:1.0:core:schema" xmlns:ns4="http://ws.gematik.de/conn/SignatureService/v7.4" xmlns:ns5="http://www.w3.org/2000/09/xmldsig#" xmlns:ns6="http://ws.gematik.de/tel/error/v2.0" xmlns:ns7="http://uri.etsi.org/01903/v1.3.2#" xmlns:ns8="http://ws.gematik.de/conn/CertificateServiceCommon/v2.0" xmlns:ns9="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:ns10="http://www.w3.org/2001/04/xmlenc#" xmlns:ns11="http://uri.etsi.org/02231/v2#" xmlns:ns12="urn:oasis:names:tc:dss-x:1.0:profiles:verificationreport:schema#" xmlns:ns13="urn:oasis:names:tc:dss-x:1.0:profiles:SignaturePolicy:schema#" xmlns:ns14="urn:oasis:names:tc:SAML:2.0:assertion">
      <Status>
        <Result>OK</Result>
      </Status>
      <ns3:SignatureObject>
        <ns3:Base64Signature Type="urn:ietf:rfc:3447">Z3BEWFNIMzQ3WFNWbXR2QWlvd0tadlphdmRyZEdIdGx1ejhRRGY4cXNBYnMzbGUvYUV6dkJEK294Z0N5UFJLcmhWdHJwMHVZQWh5aXV4MVVOdlpxak9tMkNiZC9vTXZVcUkxRWpSdEFZVWdzbUVXRFlxOThTcVN2RUlIMmhIMGdrSFB5TEU1MmhRdHJKVG9ZdmhndE5OZkFHNjJNRWJuanczdUtVSXEzQ3BjMTdhYVVRN3JtWEdHWURmWjJsUDUyT3Z0ZlJNOE03T3o2T3NlbjVLZzJwM2RoeCtyRVFQTU9aeTVLRDcxR3d6c3FocDVTd085SGtEQ0lkeUtZZ0dsNHgzbFRESCtpVjJZOWZvNnVIS1RoSCtnakJzendDMXNxM3I4VFpTb3hiOHpRZzQ1cW1KOU83cCtTUHhsTG4rU3hWTDVKaWU2aC9oSFVDYnpjUnJZZUd3PT0=</ns3:Base64Signature>
      </ns3:SignatureObject>
    </ns4:ExternalAuthenticateResponse>
  </soap:Body>
</soap:Envelope>

Development

Toolchain installation

  1. (optional) Install SDKMAN from http://sdkman.io

  2. Install Java 11 and Gradle

sdk install java
sdk install gradle
Generate RSA self signed certificates
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 1825
openssl pkcs8 -topk8 -inform PEM -in key.pem -out privatekey.pem -nocrypt
TODO: Generate ECC self signed certificates
openssl ...

Deployment


docker build -t conlibre . ---


docker run --mount type=bind,source="$(pwd)"/config,target=/conlibre/config conlibre ---

About

Con Libre: simple API simulator for gematik Konnektor

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages