{"id":26126258,"url":"https://github.com/freeedy/servicesignerbase","last_synced_at":"2026-04-17T14:32:41.779Z","repository":{"id":185970014,"uuid":"529967697","full_name":"Freeedy/ServiceSignerBase","owner":"Freeedy","description":null,"archived":false,"fork":false,"pushed_at":"2023-07-26T15:54:14.000Z","size":60,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-12T22:27:45.528Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Freeedy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-08-28T20:07:14.000Z","updated_at":"2023-08-03T21:10:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"208c2bc1-2ea4-490c-8adb-6852710af9e4","html_url":"https://github.com/Freeedy/ServiceSignerBase","commit_stats":null,"previous_names":["freeedy/servicesignerbase"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Freeedy/ServiceSignerBase","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freeedy%2FServiceSignerBase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freeedy%2FServiceSignerBase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freeedy%2FServiceSignerBase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freeedy%2FServiceSignerBase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Freeedy","download_url":"https://codeload.github.com/Freeedy/ServiceSignerBase/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freeedy%2FServiceSignerBase/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31933082,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-17T12:37:54.787Z","status":"ssl_error","status_checked_at":"2026-04-17T12:37:25.095Z","response_time":62,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2025-03-10T17:48:10.005Z","updated_at":"2026-04-17T14:32:41.761Z","avatar_url":"https://github.com/Freeedy.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Service Signer\n\nIntroducing \"Service Signer\" - a powerful library designed to enhance your API interactions. With Service Signer, you can effortlessly sign each request to any service and receive authenticated responses. By implementing key pair logic (public and private keys), this library ensures the security and integrity of your API communications. Say goodbye to manual response validation requests, as Service Signer significantly reduces the need for such interactions, helping you optimize and decrease your overall request count. Streamline your API integration with ease and peace of mind using Service Signer.\n\n\n# Overview\n\nIntroducing Service Signer Util - a robust mechanism for ensuring the integrity of each service, signing and validating their results. This powerful utility enables seamless data interaction between services without the need for online calls to verify the provided data. Leveraging cutting-edge digital signature techniques, Service Signer Util guarantees the authenticity and reliability of the exchanged information. Say goodbye to unnecessary online checks and embrace a streamlined, secure, and efficient data communication system between your services.\n\nLet's deep dive with the examples:\nImagine a scenario with four services - A, B, C, and D:\n\n* A -  Catalog Service \n    - Provides Products with prices \n* B -  Order Service \n    - Provide ORder Creation \n    - get order by id \n* C - Payment Service \n    - Create Payment for ORder \n    - Verify Order information \n    - Verify Product Information \n\n```mermaid\n  graph TD;\n      A(Catalog)--\u003e|Product info |B(ORder API );\n      C(Payment Service) --\u003e|Get Order Info|B \n      C--\u003e|Get Product Info|A\n   \n```\n\nThese services interact with each other, and Service Signer simplifies the process of checking the data they exchange.\n\n\n## Service Signer Elements\n\n`Each service has its own key pairs (public and private). You'll need to generate these key pairs and initialize the service signer with the private key. The data produced by your service will be signed, and you can choose which elements need to be signed, based on the complexity of the model.`\n\n## Installation\nYou can download the ServiceSignerBase package from NuGet Package Manager using the following command:\n```java\ndotnet add package ServiceSignerBase --version 1.0.2\n```\nOnce installed, you can start using the Service Signer in your project.\n\nFirst stage, generate key pairs for your service and save it on your environment(config file, settings, database etc). Then, share public key with the service that will consume and validate this service.\n```java\n string signalg = \"SHA-256withRSA\";\n var keypair = Util.GetKeyPairProvider(\"rsa\").GenerateServiceKeyPair(2048);\n var servicesigner = Util.GetSigner(\"rsa\");\n var privstring = keypair.Private.SerializePrivateKeyToBase58();\n var pubstring = keypair.Public.SerializePublicKeyToBase58();\n```\n**NOTE:** **The key generation process is not part of the application cycle. It must be created externally and then must be added to the application environment.**\n\n## Sign Something\n### Sign Primitive types. Int , date , string , byte etc ...\n\n```java\n ServiceSigner srvsigner = new ServiceSigner(ServiceSignerBase.Enums.SignAlgorithms.RsaSha256, privstring, pubstring);\n int tobesigned = 0; // signed payload\n var result = srvsigner.SignData(tobesigned);\n```\nIn this example, we are signing the value '0' as the payload. The resulting signed payload will look like this in JSON format:\n```json\n{\n\t\"Version\": \"1.0.1\",\n\t\"Payload\": 0,\n\t\"SignedModelType\": \"Int32\",\n\t\"Header\": {\n\t\t\"Pattern\": null,\n\t\t\"Alg\": \"SHA-256withRSA\",\n\t\t\"Signature\": \"3y2Con4UdVoyskfbVuFaGmtuF98cYcpVsLrZjE31f9mdtfanNUBNjzF4pnG9sS7Mu9CfCJDN8tB3d3m2XHn8JTgMVceMtfgohNwzayGM6GbaanywJvFa3yaLDcLmnRdiE3496YtNtxzpMmfxs5Za6fEUPxa5B7EE5XJE6CY4B7UzMyQEah38DbfwgyA588b4KNY3D6LbJRCb5hVtwLkYdE8p7dpLrhXEs8AYPnbhrQ2YvfK9cdSGzUXUKyN8gstCqw1Y6ZX2rA9NzEq3wkhUJnWBXWZHDpgsaiSqsDzQTBNE8tctRUa6EGSFV5YjMcELtCv1zxbSi4T4jZ6iSFiLcr5nLddRA8\"\n\t}\n}\n```\nThis technique can be applied to other single types as well.\n### Complex Type Signing\nFor complex models, you can choose which properties to sign by marking them with **[Signable]**.\n```java\n  public class SomeModel\n    {\n        [Signable]\n        public string Name { get; set; }\n        public string TestData { get; set; }\n        [Signable]\n        public string Surname { get; set; }\n        [Signable]\n        public DateTime DateTime { get; set; } = DateTime.Now;\n        public InnerModel InnerModel { get; set; }\n    }\n    //name+surname\n    public class InnerModel\n    {\n        public string Id { get; set; } = \"TestID\";\n        [Signable]\n        public int Year { get; set; }\n        public ThirdObject HidedObject { get; set; }\n    }\n    public class ThirdObject\n    {\n        [Signable]\n        public string HidedName { get; set; }\n        [Signable]\n        public long LongProp  { get; set; }\n        public InnerModel ModelSam { get; set; }\n    }\n```\nAll properties marked with **[Signable]** will be signed. The output will look like this in JSON format:\n```json\n{\n  \"Version\": \"1.0.1\",\n  \"SignedModelType\": \"SomeModel\",\n  \"Payload\": {\n    \"Name\": \"farid\",\n    \"TestData\": \"Test\",\n    \"Surname\": \"Ismayilzada\",\n    \"DateTime\": \"2023-04-22T18:48:37.3287232+04:00\",\n    \"InnerModel\": {\n      \"Id\": \"TestID\",\n      \"Year\": 2022,\n      \"HidedObject\": {\n        \"HidedName\": \"Secret\",\n        \"LongProp\": 50000,\n        \"ModelSam\": null\n      }\n    }\n  },\n  \"Header\": {\n    \"Pattern\": \"Name/Surname/DateTime/InnerModel.Year/InnerModel.HidedObject.HidedName/InnerModel.HidedObject.LongProp\",\n    \"Alg\": \"SHA-256withRSA\",\n    \"Signature\": \"7U4uc7VAEijstMhre6LFXCPLmxPaLp4WDfC9wVJRYr5KDnjn2YA5Y8E9bYcJakpVQrv3qUtz7di3wRfLcx2J3Yt3gDjRGnhfAh4Pr3BcLXBLtmqSVB82fgrQc88fAgURqXBdh3o6dNjxdity89zpMMHgGV98BqHJmS5ijtFzTh42tqhRBKmDUF5Fcmv5p1NbTepSprqQfuYHsZ3ZEyHKSP84dJJxZRQLUXWHUmn6fwvD5vTyhqX3n36HPm129B5h2QDgofo6rKp6DNep1FiuRrs9j9mqBjVUb8eGVYfZAPwctPa3VexxpvZZ1uWxhZvusnRoyNua4c6jy225CjDdG9RXDfS6P1\"\n  }\n}\n```\n## Verify the Record of Other Service \n\nWhile checking the integrity of the signed model if the data has been changed the `SrvInvalidSignatureException` exception will be thrown.\n\nTo verify a record from another service, use the following:\n```java\n var decer = JsonSerializer.Deserialize\u003cSrvSignedContainer\u003cSomeModel\u003e\u003e(text);\n decer.ValidateSignature(pubstring);\n signer.ValidateSignatureContainer(decer, pubstring);\n```\n\n`pubstring` represents the shared key of the service to which the data belongs.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreeedy%2Fservicesignerbase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffreeedy%2Fservicesignerbase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreeedy%2Fservicesignerbase/lists"}