-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added support for gpg option --pinentry-mode loopback for gpg version…
… 2.1 or higher added ability for user to provider cli arguments for gpg fixed nuget build script
- Loading branch information
1 parent
b383be1
commit 8620b2f
Showing
11 changed files
with
174 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="Microsoft.CodeCoverage" version="1.0.3" targetFramework="net45" /> | ||
<package id="Microsoft.NET.Test.Sdk" version="15.6.1" targetFramework="net45" /> | ||
<package id="NUnit3TestAdapter" version="3.10.0" targetFramework="net45" /> | ||
<package id="NUnitTestAdapter" version="2.1.1" targetFramework="net45" /> | ||
</packages> |
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Starksoft.Aspen.GnuPG | ||
{ | ||
/// <summary> | ||
/// GPG version number class. | ||
/// </summary> | ||
public class GpgVersion | ||
{ | ||
private int _major; | ||
private int _minor; | ||
private string _revision; | ||
|
||
public GpgVersion(int major, int minor, string revision) | ||
{ | ||
_major = major; | ||
_minor = minor; | ||
_revision = revision; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the GPG major version number. | ||
/// </summary> | ||
/// <returns>Major version number</returns> | ||
public int Major | ||
{ | ||
get { return _major; } | ||
} | ||
|
||
/// <summary> | ||
/// Gets the GPG minor version number. | ||
/// </summary> | ||
/// <returns>Minor version number</returns> | ||
public int Minor | ||
{ | ||
get { return _minor; } | ||
} | ||
|
||
/// <summary> | ||
/// Gets the GPG revision string. | ||
/// </summary> | ||
/// <returns>Revision string</returns> | ||
public string Revision | ||
{ | ||
get { return _revision; } | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Text.RegularExpressions; | ||
using System.Threading.Tasks; | ||
|
||
namespace Starksoft.Aspen.GnuPG | ||
{ | ||
/// <summary> | ||
/// GPG command line version parser. This class parses the GPG stdout data in the expected format | ||
/// gpg GnuPG major.minor.revision | ||
/// where major and minor are expected to be integers and revsision can be an integer or string. | ||
/// | ||
/// Examples: | ||
/// gpg (GnuPG) 2.2.4 | ||
/// gpg (GnuPG) 2.1.1-beta3 | ||
/// </summary> | ||
class GpgVersionParser | ||
{ | ||
private static Regex _gpgVersion = new Regex(@"(?<=gpg \(GnuPG\) )([0-9]*\.[0-9]*\..*)", RegexOptions.Compiled); | ||
|
||
/// <summary> | ||
/// Private constructor. | ||
/// </summary> | ||
private GpgVersionParser() { } | ||
|
||
/// <summary> | ||
/// Parse the GPG version information from the Stdout of the GPG command line interface | ||
/// executed with the --version argument. | ||
/// </summary> | ||
/// <param name="data">stdout stream data</param> | ||
/// <returns>GPG version object</returns> | ||
public static GpgVersion Parse(StreamReader data) | ||
{ | ||
string firstLine = ReadFirstStdOutLine(data); | ||
GpgVersion ver = ParseVersion(firstLine); | ||
return ver; | ||
} | ||
|
||
private static string ReadFirstStdOutLine(StreamReader data) | ||
{ | ||
return data.ReadLine(); | ||
} | ||
|
||
private static GpgVersion ParseVersion(string line) { | ||
|
||
if (!_gpgVersion.IsMatch(line)) | ||
{ | ||
throw new GpgException(String.Format("unexpected gpg command line version data '{0}'", line)); | ||
} | ||
|
||
string[] version = _gpgVersion.Match(line).ToString().Split('.'); | ||
int major = Int32.Parse(version[0]); | ||
int minor = Int32.Parse(version[1]); | ||
string revision = version[2]; | ||
|
||
return new GpgVersion(major, minor, revision); | ||
} | ||
|
||
} | ||
|
||
|
||
} |
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
Empty file.
Binary file not shown.