Skip to content

Commit c95cf17

Browse files
authored
Merge pull request #290 from mattosaurus/chore/package-updates
Chore/package updates
2 parents 86df3a0 + e04bfa8 commit c95cf17

File tree

6 files changed

+23
-44
lines changed

6 files changed

+23
-44
lines changed

PgpCore.Tests/PgpCore.Tests.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
<ItemGroup>
1010
<PackageReference Include="FluentAssertions" Version="6.12.0" />
11-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
12-
<PackageReference Include="xunit" Version="2.6.2" />
13-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4">
11+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
12+
<PackageReference Include="xunit" Version="2.8.1" />
13+
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1">
1414
<PrivateAssets>all</PrivateAssets>
1515
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1616
</PackageReference>

PgpCore.Tests/UnitTests/TestBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ namespace PgpCore.Tests.UnitTests
1212
public abstract class TestBase
1313
{
1414
#if NETFRAMEWORK
15-
public const string VERSION = "BouncyCastle.NET Cryptography (net461) v2.1.1+851feee009";
15+
public const string VERSION = "BouncyCastle.NET Cryptography (net461) v2.4.0+83ebf4a805";
1616
#else
17-
public const string VERSION = "BouncyCastle.NET Cryptography (net6.0) v2.1.1+851feee009";
17+
public const string VERSION = "BouncyCastle.NET Cryptography (net6.0) v2.4.0+83ebf4a805";
1818
#endif
1919
public const string DEFAULTNAME = "name";
2020
public const string TESTNAME = "Test Name";

PgpCore/Abstractions/IPGP.VerifyAsync.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public interface IVerifyAsync : IDisposable
1414
Task<bool> VerifyAsync(string input, bool throwIfEncrypted = false);
1515
Task<bool> VerifyClearAsync(FileInfo inputFile, FileInfo outputFile = null);
1616
Task<bool> VerifyClearAsync(Stream inputStream, Stream outputStream = null);
17-
Task<bool> VerifyClearAsync(string input, string output = null);
17+
Task<bool> VerifyClearAsync(string input);
1818

1919
Task<bool> VerifyFileAsync(FileInfo inputFile, bool throwIfEncrypted = false);
2020
Task<bool> VerifyStreamAsync(Stream inputStream, bool throwIfEncrypted = false);

PgpCore/PGP.VerifyAsync.cs

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public async Task<bool> VerifyAsync(Stream inputStream, Stream outputStream = nu
158158
else
159159
throw new PgpException("Message is not a encrypted and signed file or simple signed file.");
160160

161-
outputStream.Flush();
161+
await outputStream.FlushAsync();
162162
outputStream.Seek(0, SeekOrigin.Begin);
163163

164164
return (verified);
@@ -333,24 +333,6 @@ public async Task<bool> VerifyClearAsync(string input)
333333
return await VerifyClearAsync(inputStream, null);
334334
}
335335

336-
/// <summary>
337-
/// PGP verify a given string.
338-
/// </summary>
339-
/// <param name="input">Plain string to be verified</param>
340-
/// <param name="output">String to write the decrypted data to</param>
341-
public async Task<bool> VerifyClearAsync(string input, string output)
342-
{
343-
using (Stream inputStream = await input.GetStreamAsync())
344-
using (Stream outputStream = new MemoryStream())
345-
{
346-
bool verified = await VerifyClearAsync(inputStream, outputStream);
347-
348-
outputStream.Seek(0, SeekOrigin.Begin);
349-
output = await outputStream.GetStringAsync();
350-
return verified;
351-
}
352-
}
353-
354336
public async Task<bool> VerifyClearFileAsync(FileInfo inputFile) => await VerifyClearAsync(inputFile, null);
355337

356338
public async Task<bool> VerifyClearStreamAsync(Stream inputStream) => await VerifyClearAsync(inputStream, null);

PgpCore/PGP.cs

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ private async Task OutputEncryptedAsync(Stream inputStream, Stream outputStream,
8080
using (Stream compressedOut = ChainCompressedOut(encryptedOut))
8181
{
8282
PgpSignatureGenerator signatureGenerator = InitSignatureGenerator(compressedOut);
83-
using (Stream literalOut = ChainLiteralStreamOut(compressedOut, inputStream, name, oldFormat))
83+
using (Stream literalOut = ChainLiteralOut(compressedOut, inputStream, name, oldFormat))
8484
{
8585
await WriteOutputAndSignAsync(compressedOut, literalOut, inputStream, signatureGenerator);
8686
}
@@ -117,7 +117,7 @@ private void OutputEncrypted(Stream inputStream, Stream outputStream, bool withI
117117
using (Stream compressedOut = ChainCompressedOut(encryptedOut))
118118
{
119119
PgpSignatureGenerator signatureGenerator = InitSignatureGenerator(compressedOut);
120-
using (Stream literalOut = ChainLiteralStreamOut(compressedOut, inputStream, name, oldFormat))
120+
using (Stream literalOut = ChainLiteralOut(compressedOut, inputStream, name, oldFormat))
121121
{
122122
WriteOutputAndSign(compressedOut, literalOut, inputStream, signatureGenerator);
123123
}
@@ -150,7 +150,7 @@ private async Task OutputSignedAsync(Stream inputStream, Stream outputStream,
150150
using (Stream compressedOut = ChainCompressedOut(outputStream))
151151
{
152152
PgpSignatureGenerator signatureGenerator = InitSignatureGenerator(compressedOut);
153-
using (Stream literalOut = ChainLiteralStreamOut(compressedOut, inputStream, name, oldFormat))
153+
using (Stream literalOut = ChainLiteralOut(compressedOut, inputStream, name, oldFormat))
154154
{
155155
await WriteOutputAndSignAsync(compressedOut, literalOut, inputStream, signatureGenerator);
156156
}
@@ -181,7 +181,7 @@ private void OutputSigned(Stream inputStream, Stream outputStream, string name,
181181
using (Stream compressedOut = ChainCompressedOut(outputStream))
182182
{
183183
PgpSignatureGenerator signatureGenerator = InitSignatureGenerator(compressedOut);
184-
using (Stream literalOut = ChainLiteralStreamOut(compressedOut, inputStream, name, oldFormat))
184+
using (Stream literalOut = ChainLiteralOut(compressedOut, inputStream, name, oldFormat))
185185
{
186186
WriteOutputAndSign(compressedOut, literalOut, inputStream, signatureGenerator);
187187
}
@@ -390,34 +390,31 @@ private Stream ChainCompressedOut(Stream encryptedOut)
390390
private Stream ChainLiteralOut(Stream compressedOut, FileInfo file, string name, bool oldFormat)
391391
{
392392
PgpLiteralDataGenerator pgpLiteralDataGenerator = new PgpLiteralDataGenerator(oldFormat);
393-
return pgpLiteralDataGenerator.Open(compressedOut, FileTypeToChar(), name, file.Length,
393+
394+
return pgpLiteralDataGenerator.Open(compressedOut, FileTypeToChar(), name, file.Length,
394395
DateTime.UtcNow);
395396
}
396397

397-
#endregion ChainLiteralOut
398-
399-
#region ChainLiteralStreamOut
400-
401-
private Stream ChainLiteralStreamOut(Stream compressedOut, Stream inputStream, string name, bool oldFormat)
398+
private Stream ChainLiteralOut(Stream compressedOut, Stream inputStream, string name, bool oldFormat)
402399
{
403400
PgpLiteralDataGenerator pgpLiteralDataGenerator = new PgpLiteralDataGenerator(oldFormat);
404401
return pgpLiteralDataGenerator.Open(compressedOut, FileTypeToChar(), name, inputStream.Length,
405402
DateTime.UtcNow);
406403
}
407404

408-
#endregion ChainLiteralStreamOut
405+
#endregion ChainLiteralOut
409406

410-
#region InitSignatureGenerator
407+
#region InitSignatureGenerator
411408

412-
private PgpSignatureGenerator InitSignatureGenerator(Stream compressedOut)
409+
private PgpSignatureGenerator InitSignatureGenerator(Stream compressedOut)
413410
{
414411
PublicKeyAlgorithmTag tag = EncryptionKeys.SigningSecretKey.PublicKey.Algorithm;
415412
PgpSignatureGenerator pgpSignatureGenerator = new PgpSignatureGenerator(tag, HashAlgorithmTag);
416413
pgpSignatureGenerator.InitSign(PgpSignature.BinaryDocument, EncryptionKeys.SigningPrivateKey);
417414
foreach (string userId in EncryptionKeys.SigningSecretKey.PublicKey.GetUserIds())
418415
{
419416
PgpSignatureSubpacketGenerator subPacketGenerator = new PgpSignatureSubpacketGenerator();
420-
subPacketGenerator.SetSignerUserId(false, userId);
417+
subPacketGenerator.AddSignerUserId(false, userId);
421418
pgpSignatureGenerator.SetHashedSubpackets(subPacketGenerator.Generate());
422419
// Just the first one!
423420
break;
@@ -440,7 +437,7 @@ private PgpSignatureGenerator InitClearSignatureGenerator(ArmoredOutputStream ar
440437
foreach (string userId in EncryptionKeys.SigningSecretKey.PublicKey.GetUserIds())
441438
{
442439
PgpSignatureSubpacketGenerator subPacketGenerator = new PgpSignatureSubpacketGenerator();
443-
subPacketGenerator.SetSignerUserId(false, userId);
440+
subPacketGenerator.AddSignerUserId(false, userId);
444441
pgpSignatureGenerator.SetHashedSubpackets(subPacketGenerator.Generate());
445442
// Just the first one!
446443
break;

PgpCore/PgpCore.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
<PackageTags>PGP .NET Core</PackageTags>
1313
<Version>6.4.0.0</Version>
1414
<AssemblyVersion>6.0.0.0</AssemblyVersion>
15-
<FileVersion>6.4.0</FileVersion>
16-
<PackageReleaseNotes>v6.4.0 - Remove armor option from string methods</PackageReleaseNotes>
15+
<FileVersion>6.4.1</FileVersion>
16+
<PackageReleaseNotes>v6.4.1 - Package updates</PackageReleaseNotes>
1717
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1818
<PublishRepositoryUrl>true</PublishRepositoryUrl>
1919
<IncludeSymbols>true</IncludeSymbols>
@@ -121,8 +121,8 @@
121121
</ItemGroup>
122122

123123
<ItemGroup>
124-
<PackageReference Include="BouncyCastle.Cryptography" Version="2.1.1" />
125-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
124+
<PackageReference Include="BouncyCastle.Cryptography" Version="2.4.0" />
125+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
126126
</ItemGroup>
127127

128128
</Project>

0 commit comments

Comments
 (0)