https://github.com/bitbeans/naclkeys
Library to generate libsodium-net compatible KeyPair`s
https://github.com/bitbeans/naclkeys
Last synced: 8 months ago
JSON representation
Library to generate libsodium-net compatible KeyPair`s
- Host: GitHub
- URL: https://github.com/bitbeans/naclkeys
- Owner: bitbeans
- License: mit
- Created: 2015-05-22T08:37:43.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2016-01-02T06:30:33.000Z (about 10 years ago)
- Last Synced: 2025-01-05T10:03:11.485Z (about 1 year ago)
- Language: C#
- Size: 1.14 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# NaclKeys [](https://ci.appveyor.com/project/bitbeans/naclkeys) [](https://travis-ci.org/bitbeans/NaclKeys) [](https://www.nuget.org/packages/NaclKeys/) [](https://github.com/bitbeans/NaclKeys/blob/master/LICENSE.md)
Small library to generate libsodium-net compatible KeyPair`s and encoded public keys based on predefined formats.
## Code Status
NaclKeys was subjected to a source code audit carried out by [Paragon Initiative Enterprises, LLC](https://paragonie.com/).
Final report (Web): [Audit-Report NaclKeys 07.2015](https://paragonie.com/audit/2QB0t20PnxjevVA0)
Final report (PDF): [Audit-Report NaclKeys 07.2015](https://paragonie.com/static/audit-reports/2015/07/NaclKeys.pdf)
## Installation
There is a [NuGet package](https://www.nuget.org/packages/NaclKeys/) available.
## Supported Formats
### CurveLock Format
Project: [CurveLock](https://github.com/adamcaudill/CurveLock)
#### Methods
```csharp
public static KeyPair GenerateCurveLockKeyPair(string email, string password)
```
```csharp
public static string EncodeCurveLockPublicKey(byte[] publicKey)
```
```csharp
public static byte[] DecodeCurveLockPublicKey(string encodedPublicKey)
```
#### Example
```csharp
const string email = "someone@example.com";
const string password = "magnetometers payee induce tangibly polonaises unrestricted oilfield";
var keyPair = KeyGenerator.GenerateCurveLockKeyPair(email, password);
var encodedPublicKey = KeyGenerator.EncodeCurveLockPublicKey(keyPair.PublicKey);
```
> MrDDGk7GYEypr93LMgJn4Av3c98fWamRKvAKbjrTEvjtz5kRxj
### miniLock Format
Project: [miniLock](https://github.com/kaepora/miniLock)
#### Methods
```csharp
public static KeyPair GenerateMiniLockKeyPair(string email, string password)
```
```csharp
public static string EncodeMiniLockPublicKey(byte[] publicKey)
```
```csharp
public static byte[] DecodeMiniLockPublicKey(string encodedPublicKey)
```
#### Example
```csharp
const string email = "someone@example.com";
const string password = "magnetometers payee induce tangibly polonaises unrestricted oilfield";
var keyPair = KeyGenerator.GenerateMiniLockKeyPair(email, password);
var encodedPublicKey = KeyGenerator.EncodeMiniLockPublicKey(keyPair.PublicKey);
```
> Cz5bEJLKdSib9kWxkmskExaaLdRg8tVA2qsFBnfdQwkMe
### bytejail Format
Project: [bytejail](https://bytejail.com)
#### Methods
```csharp
public static KeyPair GenerateBytejailKeyPair(string userInputPartOne, string userInputPartTwo)
```
```csharp
public static string EncodeBytejailPublicKey(byte[] publicKey)
```
```csharp
public static byte[] DecodeBytejailPublicKey(string encodedPublicKey)
```
#### Example
```csharp
const string email = "someone@example.com";
const string password = "magnetometers payee induce tangibly polonaises unrestricted oilfield";
var keyPair = KeyGenerator.GenerateBytejailKeyPair(email, password);
var encodedPublicKey = KeyGenerator.EncodeBytejailPublicKey(keyPair.PublicKey);
```
> 2PNPvrfYAQxhaGYaAzsWTYgEzymmQZ37jG2vJThBJHDcY4SABnH
##Helper
It`s also possible to recognize an identity format
```csharp
public static KeyType TryRecognizeIdentityFormat(string encodedPublicKey, bool validate = true)
```
## More Examples
see [Unit Tests](https://github.com/bitbeans/NaclKeys/tree/master/Tests)
## License
[MIT](https://en.wikipedia.org/wiki/MIT_License)