{"id":30755189,"url":"https://github.com/Namoshek/OpenChargeMeteringFormat","last_synced_at":"2025-09-04T10:04:32.699Z","repository":{"id":36978422,"uuid":"502076839","full_name":"Namoshek/OpenChargeMeteringFormat","owner":"Namoshek","description":"A .NET implementation of the Open Charge Metering Format (OCMF).","archived":true,"fork":false,"pushed_at":"2025-01-20T05:07:55.000Z","size":139,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-01T02:25:50.079Z","etag":null,"topics":["csharp","dotnet","ocmf"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Namoshek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-10T14:39:03.000Z","updated_at":"2025-07-11T18:25:00.000Z","dependencies_parsed_at":"2023-01-17T10:45:34.594Z","dependency_job_id":"42782678-2e4a-430f-a4da-03b3d0ecbdb9","html_url":"https://github.com/Namoshek/OpenChargeMeteringFormat","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/Namoshek/OpenChargeMeteringFormat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Namoshek%2FOpenChargeMeteringFormat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Namoshek%2FOpenChargeMeteringFormat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Namoshek%2FOpenChargeMeteringFormat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Namoshek%2FOpenChargeMeteringFormat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Namoshek","download_url":"https://codeload.github.com/Namoshek/OpenChargeMeteringFormat/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Namoshek%2FOpenChargeMeteringFormat/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273588927,"owners_count":25132858,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-04T02:00:08.968Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","dotnet","ocmf"],"created_at":"2025-09-04T10:01:33.578Z","updated_at":"2025-09-04T10:04:32.679Z","avatar_url":"https://github.com/Namoshek.png","language":"C#","funding_links":[],"categories":["Tools and Resources"],"sub_categories":["OCMF"],"readme":"# OpenChargeMeteringFormat [![Nuget](https://img.shields.io/nuget/v/OpenChargeMeteringFormat?style=flat-square)](https://nuget.org/packages/OpenChargeMeteringFormat)\n\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=Namoshek_OpenChargeMeteringFormat\u0026metric=coverage)](https://sonarcloud.io/summary/new_code?id=Namoshek_OpenChargeMeteringFormat)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Namoshek_OpenChargeMeteringFormat\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=Namoshek_OpenChargeMeteringFormat)\n[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=Namoshek_OpenChargeMeteringFormat\u0026metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=Namoshek_OpenChargeMeteringFormat)\n[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=Namoshek_OpenChargeMeteringFormat\u0026metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=Namoshek_OpenChargeMeteringFormat)\n[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=Namoshek_OpenChargeMeteringFormat\u0026metric=security_rating)](https://sonarcloud.io/summary/new_code?id=Namoshek_OpenChargeMeteringFormat)\n[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=Namoshek_OpenChargeMeteringFormat\u0026metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=Namoshek_OpenChargeMeteringFormat)\n\n[`OpenChargeMeteringFormat`](https://www.nuget.org/packages/OpenChargeMeteringFormat/) was created by, and is maintained\nby [Marvin Mall](https://github.com/namoshek).\nIt provides a .NET parser and verifier for the [Open Charge Metering Format (OCMF)](https://github.com/SAFE-eV/OCMF-Open-Charge-Metering-Format).\n\n## Installation\n\nThe package can be found on [nuget.org](https://www.nuget.org/packages/OpenChargeMeteringFormat/).\nYou can install the package with:\n\n```pwsh\nInstall-Package OpenChargeMeteringFormat\n```\n\n## Usage\n\n### Parse OCMF\n\nTo parse an OCMF message, use the `OpenChargeMeteringFormatParser`.\nIt provides you with two methods to validate and parse OCMF messages:\n\n```csharp\nvar message = \"OCMF|{...}|{...}\";\n\n// Optional: validate messages before usage\nif (!OpenChargeMeteringFormatParser.IsValidMessage(message))\n{\n    Console.WriteLine(\"Not a valid OCMF message.\");\n\n    return;\n}\n\n// Mandatory: parse messages with implicit validation\nvar parseResult = OpenChargeMeteringFormatParser.ParseMessage(message);\nif (parseResult.IsFailed)\n{\n    if (parseResult.HasError\u003cInputIsNotAnOpenChargeMeteringFormatMessage\u003e())\n    {\n        Console.WriteLine(\"The given string is not a valid OCMF message according to the specification.\");\n    }\n    else if (parseResult.HasError\u003cPayloadHasAnInvalidFormat\u003e())\n    {\n        Console.WriteLine(\"The given OCMF message contains an invalid payload.\");\n    }\n    else\n    {\n        Console.WriteLine($\"Not a valid OCMF message: {parseResult.Errors.First().Message}\");\n    }\n\n    return;\n}\n\nConsole.WriteLine($\"Identification status: {parseResult.Value.Payload.IdentificationStatus}\");\nConsole.WriteLine($\"Identification type: {parseResult.Value.Payload.IdentificationType}\");\nConsole.WriteLine($\"Identification data: {parseResult.Value.Payload.IdentificationData}\");\n```\n\n`IsValidMessage(message)` will only perform structural tests, no actual verification of the signature.\n\n### Verify OCMF signature\n\nTo verify the signature of a parsed OCMF message, use the `OpenChargeMeteringFormatVerifier`.\nIt provides a `Verify(OpenChargeMeteringFormatMessage message, string publicKey)` method,\nwhere you have to pass the output of `OpenChargeMeteringFormatParser.ParseMessage(message)`\nas well as the public key of the charge point meter.\n\n```csharp\nvar message = \"OCMF|{...}|{...}\";\nvar publicKey = \"A0B1C2...\";\n\nvar parseResult = OpenChargeMeteringFormatParser.ParseMessage(message);\nif (parseResult.IsFailed)\n{\n    return;\n}\n\nvar verificationResult = OpenChargeMeteringFormatVerifier.Verify(parseResult.Value, publicKey);\nif (verificationResult.IsFailed)\n{\n    Console.WriteLine(\"The OCMF message has an invalid signature or the provided public key is invalid.\");\n}\n```\n\n### Method results\n\nThis library makes use of [`FluentResults`](https://github.com/altmann/FluentResults),\nwhich allows returning a `Result\u003cOpenChargeMeteringFormatMessage\u003e` covering both,\nthe success and the error scenario.\n\nTo check for success, use `Result\u003cOpenChargeMeteringFormatMessage\u003e.IsSuccess`.\nA success result will also contain a valid `Result\u003cOpenChargeMeteringFormatMessage\u003e.Value`\nwith the parsed OCMF message as content.\n\nTo check for failure, use `Result\u003cOpenChargeMeteringFormatMessage\u003e.IsFailed`.\nIn case of failure, the result _may_ contains errors which can be retrieved using\n`Result\u003cOpenChargeMeteringFormatMessage\u003e.Errors`. To check for presence of errors,\nuse `Result\u003cOpenChargeMeteringFormatMessage\u003e.Errors.Any()`.\n\n`IsSuccess` and `IsFailed` are mutually exclusive, i.e. when one is `true`, the other is `false`.\n\n## License\n\nThis library is open-sourced software licensed under the [MIT license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNamoshek%2FOpenChargeMeteringFormat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNamoshek%2FOpenChargeMeteringFormat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNamoshek%2FOpenChargeMeteringFormat/lists"}