?
Solved

Why can I not decrypt a file with BouncyCastle library?

Posted on 2010-01-13
7
Medium Priority
?
1,785 Views
Last Modified: 2013-12-17
I have tried to implement the BouncyCastle library to encrypt and decrypt files. When I encrypt a file with it I can also decrypt it. But when I try to decrypt a file from a counterparty I run into trouble.

I get an exception telling me "unknown block type", and if I follow the exception being thrown from there I get "exception decrypting secret key".

The secret key I'm trying to use works fine with PGP Desktop and with Gpg4win command line tool.

How is it possible that this generates an exception?
0
Comment
Question by:lynxSE
  • 2
  • 2
4 Comments
 
LVL 39

Accepted Solution

by:
abel earned 1000 total points
ID: 26323404
A possible reason is that the file is not exactly in the format you expect it to be. For instance, perhaps it is sent to you in Base-64 or the chosen encryptions are different. I assume you already googled and have seen solutions like these?

This post shows that the incompatibility you mention is indeed correct and apparently a bug in the software. There's no follow-up, but you may try the mailing list yourself.

I assume BouncyCastle is ported to .NET with largely the same codebase as the Java codebase.
0
 

Author Comment

by:lynxSE
ID: 26323849
I have googled around but I'm not sure I could interpret the solution in a fashionable way. I have an alternative solution I will work with since this is (most likely) a bug in BouncyCastle. I am already on their mailing list but response I've been getting is not of great satisfaction.

I will use GPP command tool instead. Thank you for your time!
0
 
LVL 39

Expert Comment

by:abel
ID: 26324119
You're welcome! :)
0
 

Author Closing Comment

by:lynxSE
ID: 31676652
Didn't find a proper solution, but stated that there may be a bug in third party component.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article covers the basics of data encryption, what it is, how it works, and why it's important. If you've ever wondered what goes on when you "encrypt" data, you can look here to build a good foundation for your personal learning.
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Suggested Courses
Course of the Month8 days, 7 hours left to enroll

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question