Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions PgpCore/PGP.EncryptSync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using PgpCore.Models;
using PgpCore.Abstractions;
using PgpCore.Extensions;
using static System.Net.Mime.MediaTypeNames;

namespace PgpCore
{
Expand Down Expand Up @@ -99,7 +100,16 @@ public void Encrypt(
PgpPublicKey publicKey = publicKeyRing.PreferredEncryptionKey ?? publicKeyRing.DefaultEncryptionKey;
pk.AddMethod(publicKey);
}

/*
Encoding cp1253 = Encoding.GetEncoding(1253);
string text;
using (StreamReader reader = new StreamReader(inputStream, cp1253))
{
text = reader.ReadToEnd();
}
byte[] cp1253Bytes = cp1253.GetBytes(text);
MemoryStream inputStream1253 = new MemoryStream(cp1253Bytes);
*/
Comment on lines +103 to +112
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove if not being used please

if (CompressionAlgorithm != CompressionAlgorithmTag.Uncompressed)
{
using (Stream @out = pk.Open(outputStream, new byte[1 << 16]))
Expand Down Expand Up @@ -142,7 +152,9 @@ public string Encrypt(
if (headers == null)
headers = new Dictionary<string, string>();

using (Stream inputStream = input.GetStream())
Encoding encoding1253 = Encoding.GetEncoding(1253);

using (Stream inputStream = input.GetStream(encoding1253))
using (Stream outputStream = new MemoryStream())
{
Encrypt(inputStream, outputStream, true, withIntegrityCheck, name, headers, oldFormat);
Expand Down
6 changes: 3 additions & 3 deletions PgpCore/PGP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ public partial class PGP : IPGP
private const int BufferSize = 0x10000;
private const string DefaultFileName = "name";

public CompressionAlgorithmTag CompressionAlgorithm { get; set; } = CompressionAlgorithmTag.Uncompressed;
public CompressionAlgorithmTag CompressionAlgorithm { get; set; } = CompressionAlgorithmTag.Zip;

public SymmetricKeyAlgorithmTag SymmetricKeyAlgorithm { get; set; } = SymmetricKeyAlgorithmTag.TripleDes;
public SymmetricKeyAlgorithmTag SymmetricKeyAlgorithm { get; set; } = SymmetricKeyAlgorithmTag.Aes256;

public int PgpSignatureType { get; set; } = PgpSignature.DefaultCertification;

public PublicKeyAlgorithmTag PublicKeyAlgorithm { get; set; } = PublicKeyAlgorithmTag.RsaGeneral;

public PGPFileType FileType { get; set; } = PGPFileType.Binary;

public HashAlgorithmTag HashAlgorithmTag { get; set; } = HashAlgorithmTag.Sha1;
public HashAlgorithmTag HashAlgorithmTag { get; set; } = HashAlgorithmTag.Sha256;

public IEncryptionKeys EncryptionKeys { get; private set; }

Expand Down
2 changes: 1 addition & 1 deletion PgpCore/PgpCore.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net472</TargetFramework>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this now targeting .NET 4.72?

<Description>.NET Standard class library for using PGP</Description>
<Authors>mattosaurus</Authors>
<Company />
Expand Down