-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #260 from mattosaurus/bug/254-verify-error
Bug/254 verify error
- Loading branch information
Showing
4 changed files
with
88 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ If you want a (basic) example of how you can use an Azure Function to encrypt/de | |
## Methods | ||
|
||
* [Generate Key](#generate-key) | ||
* [Inspect](#inspect) | ||
* [Encrypt](#encrypt) | ||
* [Sign](#sign) | ||
* [Clear Sign](#clear-sign) | ||
|
@@ -56,6 +57,64 @@ using (PGP pgp = new PGP()) | |
pgp.GenerateKey(@"C:\TEMP\Keys\public.asc", @"C:\TEMP\Keys\private.asc", "[email protected]", "password"); | ||
} | ||
``` | ||
#### Inspect | ||
Inspect the provided file, stream or string to determine if it is encrypted or signed. | ||
|
||
[`gpg --list-packets "C:\TEMP\Content\encrypted.pgp"`](https://www.gnupg.org/gph/en/manual/x135.html) | ||
### Inspect File | ||
```C# | ||
// Load keys | ||
FileInfo publicKey = new FileInfo(@"C:\TEMP\Keys\public.asc"); | ||
FileInfo privateKey = new FileInfo(@"C:\TEMP\Keys\private.asc"); | ||
EncryptionKeys encryptionKeys = new EncryptionKeys(publicKey, privateKey, "password"); | ||
|
||
// Reference input file | ||
FileInfo inputFile = new FileInfo(@"C:\TEMP\Content\encrypted.pgp"); | ||
|
||
// Inspect | ||
PGP pgp = new PGP(); | ||
PgpInspectResult result = await pgp.InspectAsync(inputFile); | ||
``` | ||
### Inspect File | ||
```C# | ||
// Load keys | ||
FileInfo publicKey = new FileInfo(@"C:\TEMP\Keys\public.asc"); | ||
FileInfo privateKey = new FileInfo(@"C:\TEMP\Keys\private.asc"); | ||
EncryptionKeys encryptionKeys = new EncryptionKeys(publicKey, privateKey, "password"); | ||
|
||
// Reference input file | ||
FileInfo inputFile = new FileInfo(@"C:\TEMP\Content\encrypted.pgp"); | ||
|
||
// Inspect | ||
PGP pgp = new PGP(); | ||
PgpInspectResult result = await pgp.InspectAsync(inputFile); | ||
``` | ||
### Inspect Stream | ||
```C# | ||
// Load keys | ||
EncryptionKeys encryptionKeys; | ||
using (Stream publicKeyStream = new FileStream(@"C:\TEMP\Keys\public.asc", FileMode.Open)) | ||
using (Stream privateKeyStream = new FileStream(@"C:\TEMP\Keys\private.asc", FileMode.Open)) | ||
encryptionKeys = new EncryptionKeys(publicKeyStream, privateKeyStream, "password"); | ||
|
||
PGP pgp = new PGP(encryptionKeys); | ||
|
||
// Reference input stream | ||
using (FileStream inputFileStream = new FileStream(@"C:\TEMP\Content\encrypted.pgp", FileMode.Open)) | ||
// Inspect | ||
PgpInspectResult result = await pgp.InspectAsync(inputFileStream); | ||
``` | ||
### Inspect String | ||
```C# | ||
// Load keys | ||
string publicKey = File.ReadAllText(@"C:\TEMP\Keys\public.asc"); | ||
string privatyeKey = File.ReadAllText(@"C:\TEMP\Keys\private.asc"); | ||
EncryptionKeys encryptionKeys = new EncryptionKeys(publicKey, privateKey, "password"); | ||
|
||
// Inspect | ||
PGP pgp = new PGP(encryptionKeys); | ||
PgpInspectResult result = await pgp.InspectAsync("String to inspect"); | ||
``` | ||
### Encrypt | ||
Encrypt the provided file, stream or string using a public key. | ||
|
||
|