Comments (5)
Hi, did you get this error whilst using PgpCore? If so can you share your code please.
from pgpcore.
Hi @mattosaurus,
i am using PgpCore 6.2.0 with bouncyCastle.Cryptography 2.1.1
this is my code:
`
using Microsoft.Azure.Functions.Worker;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using PgpCore;
namespace encrypt_pgp_01_Firma
{
public class Function1
{
private readonly ILogger _logger;
private readonly IConfiguration _configuration;
public Function1(ILogger<Function1> logger, IConfiguration configuration)
{
_logger = logger;
_configuration = configuration;
}
[Function(nameof(Function1))]
public async Task Run([BlobTrigger("%rawcontainer%Firma_{name}.csv", Connection = "")] Stream stream, string name)
{
// Stream - Version:
// Load keys
EncryptionKeys encryptionKeys;
using (Stream publicKeyStream = new FileStream(@"C:\Users\frederik.ceglarek\Desktop\ReportingBeegyPublicKey.asc", FileMode.Open))
encryptionKeys = new EncryptionKeys(publicKeyStream);
// Reference input/output files
PGP pgp = new PGP(encryptionKeys);
using (FileStream inputFileStream = new FileStream(@"C:\Users\frederik.ceglarek\Desktop\Firma_20231206.csv", FileMode.Open))
using (Stream outputFileStream = File.Create(@"C:\Users\frederik.ceglarek\Desktop\Neuer Ordner\Firma_20231206.pgp"))
await pgp.EncryptAsync(inputFileStream, outputFileStream);
/*
// File - Version:
// Load keys
FileInfo publicKey = new FileInfo(@"C:\Users\frederik.ceglarek\Desktop\ReportingBeegyPublicKey.asc");
EncryptionKeys encryptionKeys = new EncryptionKeys(publicKey);
// Reference input/output files
FileInfo inputFile = new FileInfo(@"C:\Users\frederik.ceglarek\Desktop\Firma_20231206.csv");
FileInfo encryptedFile = new FileInfo(@"C:\Users\frederik.ceglarek\Desktop\Neuer Ordner\Firma_20231206.pgp");
// Encrypt
PGP pgp = new PGP(encryptionKeys);
await pgp.EncryptAsync(inputFile, encryptedFile);
*/
}
}
}
`
Curious thing is, when i use the File encryption, it works properly, only when i try to use stream encryption, the mentioned error occurs.
from pgpcore.
Cool, I'll take a look later when I get a chance (hopefully today or tomorrow). If this is urgent I'd suggest reverting back to v5.13.1 for now.
My initial thought is that the stream gets read by something else in PgpCore first and is then at the end when it comes to be read by this process.
from pgpcore.
Hi,
i was able to solve this by going back to v5.13.1.
I think pgp.EncryptAsync is not available in this version so I used pgp.EncryptStreamAsync, which worked as aspected!
Thanks for your help!
from pgpcore.
This was an issue with not setting the filename when one was available. It should now be fixed in v6.3.
from pgpcore.
Related Issues (20)
- Nuget publishing? HOT 1
- SignStreamAsync without armor results in closed outputstream HOT 1
- Does this library support Ascii Armor? If so, please provide a sample code HOT 1
- Getting error with Verify HOT 1
- SonarQube scanner java error HOT 1
- PGPCore Error: Org.BouncyCastle.Bcpg.OpenPgp.PgpSecretKeyRing found where PgpPublicKeyRing expected HOT 1
- Verified file has extra characters. HOT 10
- hash algorithm constant mismatch with bouncy castle when sign
- Generate Key example command doesn't work as provided
- Verify methods should also verify clear signed files
- Add a dethatched sign method
- Add multiple Private Keys to Encryption keys HOT 11
- DecryptStream is very slow HOT 1
- Provide FileName associated with the encrypted data stream HOT 1
- Cannot select non-default PublicKeyAlgorithmTag HOT 2
- VerifyClearAsync string,string overload does not update output variable HOT 2
- Support Network stream HOT 3
- Could not find any signing keys in keyring HOT 2
- Publish latest release to NuGet HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pgpcore.