{"id":19198509,"url":"https://github.com/virgilsecurity/virgil-crypto-net","last_synced_at":"2025-05-09T01:20:19.985Z","repository":{"id":90250382,"uuid":"61277478","full_name":"VirgilSecurity/virgil-crypto-net","owner":"VirgilSecurity","description":"Virgil .NET Crypto Library is a high-level cryptographic library that allows you to perform all necessary operations for secure storing and transferring data and everything required to become HIPAA and GDPR compliant.","archived":false,"fork":false,"pushed_at":"2016-12-12T18:48:44.000Z","size":146,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-20T10:41:45.859Z","etag":null,"topics":["crypto","cryptography","e2ee","encryption","end-to-end-encryption","gdpr","hipaa"],"latest_commit_sha":null,"homepage":"https://developer.virgilsecurity.com/docs/how-to#cryptography","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/VirgilSecurity.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-06-16T08:52:46.000Z","updated_at":"2023-11-16T18:28:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"bb706835-e71e-4acc-88f7-d3a4571372a6","html_url":"https://github.com/VirgilSecurity/virgil-crypto-net","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VirgilSecurity%2Fvirgil-crypto-net","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VirgilSecurity%2Fvirgil-crypto-net/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VirgilSecurity%2Fvirgil-crypto-net/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VirgilSecurity%2Fvirgil-crypto-net/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VirgilSecurity","download_url":"https://codeload.github.com/VirgilSecurity/virgil-crypto-net/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253171844,"owners_count":21865409,"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","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":["crypto","cryptography","e2ee","encryption","end-to-end-encryption","gdpr","hipaa"],"created_at":"2024-11-09T12:22:30.714Z","updated_at":"2025-05-09T01:20:19.976Z","avatar_url":"https://github.com/VirgilSecurity.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Library: Virgil Crypto for managed .NET\n\nThis library implements ICrypto interface in Virgil SDK .NET using [Bouncy Castle](https://www.bouncycastle.org/csharp/index.html) library and [Chaos.NaCL](https://github.com/CodesInChaos/Chaos.NaCl) Ed25519/Curve25519 implementation\n\n# Installation and usage \nNuget location: http://www.nuget.org/packages/virgil.sdk.managedcrypto\n```\nInstall-Package Virgil.SDK -Pre\nInstall-Package Virgil.SDK.ManagedCrypto -Pre\n```\nUse this crypto with [Virgil SDK](https://github.com/VirgilSecurity/virgil-sdk-net) that will provide your to create an secure application using Virgil Security services.\n\n# Usage\nThe `ManagedCrypto` class provides cryptographic operations in applications, such as hashing, signature generation and verification, and encryption and decryption.\n\n```csharp\nvar crypto = new ManagedCrypto();\n```\n\n## Generate Keys\nThe following code sample illustrates key pair generation.\n\n```charp\n var aliceKeys = crypto.GenerateKeys();\n```\n\n## Import and Export Keys\nAll `crypto` api methods accept and return keys in an internal format. \nTo get the raw key data as `byte[]` object use `ExportPrivateKey` and `ExportPublicKey` methods of `crypto` \npassing the appropriate internal key representation. To get the internal key representation out of the raw key data \nuse `ImportPrivateKey` and `ImportPublicKey` respectively:\n\n```csharp\n var exportedPrivateKey = crypto.ExportPrivateKey(aliceKeys.PrivateKey);\n var exportedPublicKey = crypto.ExportPublicKey(aliceKeys.PublicKey);\n\n var privateKey = crypto.importPrivateKey(exportedPrivateKey);\n var publicKey = crypto.importPublicKey(exportedPublicKey);\n```\n\nIf you want to encrypt the private key before exporting it you must provide a password to encrypt the key with \nas a second parameter to `ExportPrivateKey` function. Similarly, if you want to import a private key that has been\nencrypted - provide a password as a second parameter to `ImportPrivateKey` method:\n\n```csharp\nvar exportedEncryptedKey = crypto.ExportPrivateKey(aliceKeys.PrivateKey, 'pa$$w0rd');\nvar importedEncryptedKey = crypto.ImportPublicKey(exportedPublicKey, 'pa$$w0rd');\n```\n\n## Encryption and Decryption\nData encryption using ECIES scheme with AES-GCM.\n\nGenerate keypair\n\n```javascript\nvar alice = crypto.GenerateKeys();\n```\n\n### Encrypt Data\n\nThe `crypto.Encrypt` method requires two parameters:\n- **data** - The data to be encrypted as a `byte[]`\n- **recipients** - Public key or an array of Public keys to encrypt the data with\n\n```csharp\nvar plaintext = Encoding.UTF8.GetBytes(\"Nice and easy\");\nvar cipherData = crypto.Encrypt(plaintext, alice.PublicKey);\n```\n\n### Decrypt Data\n\nThe `crypto.Decrypt` method requires two parameters:\n- **cipherData** - Encrypted data as a `byte[]`\n- **privateKey** - The Private key to decrypt with\n\n```javascript\nvar decryptedData = crypto.Decrypt(cipherData, alice.PrivateKey);\n```\n\n## Signatures\nThis section walks you through the steps necessary to use the `crypto` to generate a digital signature for data and to verify that a signature is authentic. \n\nGenerate a new Public/Private keypair and *data* to be signed.\n\n```javascript\nvar alice = crypto.GenerateKeys();\nvar data = Encoding.UTF8.GetBytes(\"Hello Bob, How are you?\");\n```\n\n### Generate Signature\n\nSign the SHA-384 fingerprint of data using your private key. To generate the signature, simply call one of the sign methods:\n\n```javascript\nvar signature = crypto.Sign(data, alice.PrivateKey);\n```\n\n### Verify Signature\n\nVerify the signature of the SHA-384 fingerprint of data using Public key. The signature can now be verified by calling the verify method:\n\n```javascript\n var isValid = crypto.Verify(data, signature, alice.PublicKey);\n ```\n \n## Authenticated Encryption\nAuthenticated Encryption provides both data confidentiality and data integrity assurances to the information being protected.\n\n```javascript\n \nvar alice = crypto.GenerateKeys();\nvar bob = crypto.GenerateKeys();\n\n// The data to be signed with alice's Private key\nvar data = Encoding.UTF8.GetBytes(\"Hello Bob, How are you?\");\n```\n\n### Sign then encrypt\nGenerates the signature, encrypts the data and attaches the signature to the cipher data. Returns a signed cipher data. \nTo encrypt for multiple recipients, pass an array of public keys as third parameter\n\n```csharp\nvar cipherData = crypto.SignThenEncrypt(data, alice.PrivateKey, bob.PublicKey);\n```\n\n### Decrypt then verify\nDecrypts the data and verifies attached signature. Returns decrypted data if verification succeeded or throws `CryptoException` if it failed. \n\n```csharp\nvar decryptedData = crypto.DecryptThenVerify(cipherData, bob.PrivateKey, alice.PublicKey);\n```\n \n## Fingerprint Generation\nThe default algorithm for Fingerprint generation is SHA-256.\n```csharp\nvar content = Encoding.UTF8.GetBytes(\"CONTENT_TO_CALCULATE_FINGERPRINT_OF\");\nvar fingerprint = crypto.CalculateFingerprint(content);\n```\n\n\n# It supports:\n\n* Ed25519 public/private keys import/export\n* ECIES encryption/decryption using Curve25519/AES-GCM/SHA384\n* EDDSA signatures\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvirgilsecurity%2Fvirgil-crypto-net","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvirgilsecurity%2Fvirgil-crypto-net","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvirgilsecurity%2Fvirgil-crypto-net/lists"}