https://github.com/dracoon/dracoon-csharp-crypto-sdk
Official DRACOON Crypto SDK for C#
https://github.com/dracoon/dracoon-csharp-crypto-sdk
crypto cryptography csharp dracoon sdk
Last synced: 6 months ago
JSON representation
Official DRACOON Crypto SDK for C#
- Host: GitHub
- URL: https://github.com/dracoon/dracoon-csharp-crypto-sdk
- Owner: dracoon
- License: apache-2.0
- Created: 2017-10-30T08:34:30.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2024-06-12T08:54:45.000Z (about 1 year ago)
- Last Synced: 2024-12-01T00:29:54.981Z (7 months ago)
- Topics: crypto, cryptography, csharp, dracoon, sdk
- Language: C#
- Homepage:
- Size: 205 KB
- Stars: 4
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.com/dracoon/)
# Dracoon C# Crypto SDKA library which implements the client-side encryption of Dracoon.
# Introduction
A document which describes the client-side encryption in detail can be found here:
https://support.dracoon.com/hc/en-us/articles/360000986345
# Setup
#### Minimum Requirements
.NET Standard 2.0
#### Download
NuGet: Add the this dependency to your packages.config:
If you're using nuget with package management "Packages.config", then edit your project's "packages.config" and add this to the packages section:
```xml```
If you are using Visual Studio 2017 (or higher) add you're using nuget with package management "PackageReference" then edit your .csproj file and add this to the package dependency group:
```xml```
DLL import: The latest DLL can be found [here](https://github.com/dracoon/dracoon-csharp-crypto-sdk/releases).
Note that you also need to include the following dependencies:
1. Bouncy Castle Provider (v2.4.0): https://www.nuget.org/packages/BouncyCastle.Cryptography# Example
An example can be found here: `DracoonCryptoSdkExample/Program.cs`
The example shows the complete encryption workflow, i.e. generate user keypair, validate user keypair, generate file key, encrypt file key, and finally encrypt and decrypt a file.
```c#
static void Main(String[] args) {
// --- INITIALIZATION ---
// Generate key pair
UserKeyPair userKeyPair = Crypto.GenerateUserKeyPair(USER_PASSWORD);
// Check key pair
if (!Crypto.CheckUserKeyPair(userKeyPair, USER_PASSWORD)) {
...
}byte[] plainData = Encoding.UTF8.GetBytes(DATA);
...
// --- ENCRYPTION ---
// Generate plain file key
PlainFileKey fileKey = Crypto.GenerateFileKey();
// Encrypt blocks
byte[] encData = EncryptData(fileKey, plainData);
// Encrypt file key
EncryptedFileKey encFileKey = Crypto.EncryptFileKey(fileKey, userKeyPair.UserPublicKey);...
// --- DECRYPTION ---
// Decrypt file key
PlainFileKey decFileKey = Crypto.DecryptFileKey(encFileKey, userKeyPair.UserPrivateKey, USER_PASSWORD);
// Decrypt blocks
byte[] decData = DecryptData(decFileKey, encData);
}
```# Copyright and License
Copyright 2021 Dracoon GmbH. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
language governing permissions and limitations under the License.