Giter Site home page Giter Site logo

Comments (3)

Muraad avatar Muraad commented on May 31, 2024

It seems it is already know at least for the java version http://bouncy-castle.1462172.n4.nabble.com/checksum-mismatch-at-0-of-20-while-trying-to-extract-PGP-Secret-Key-with-Umlaut-PIN-created-by-gnupg-td4657144.html

But it also seems there is no standard for the passphrase encoding. So the "solution" is to (brute force) try all, or the most common encodings.
Maybe it is enough to make a MakeKeyFromPassPhrase overload that takes an Encoding as argument, and leave it to the caller how to handle encoding failures?

It´s used in 3 places https://github.com/bcgit/bc-csharp/search?utf8=%E2%9C%93&q=PgpUtilities.MakeKeyFromPassPhrase

from bc-csharp.

Muraad avatar Muraad commented on May 31, 2024

Hmm... "GNUPG assumes UTF-8 for PKCS#12 passwords unless a locale (e.g. Latin1, CP850) has been explictly set with --p12-charset. Utilities like gpgsm are a bit more clever/worse and try a whole bunch (unless —p12-charset is set). See minip12.c; function decrypt_block; it will try the local locale/raw, ISO-8859-1, 15, 2,3, 4 - 9, KOI8, IBM437, 850, EUC, and BIG5. Most other utils just try utf8, the locale and then iso_8859-1(5). All in that order. And in each case it will clean any mess found - by re-encoding where needed as proper utf8 or UCS-2 in BMP when a charset is specified. "

from bc-csharp.

peterdettman avatar peterdettman commented on May 31, 2024

We've added alternative versions of various methods that accept a passphrase; xxxUtf8 that converts it to bytes using Encoding.UTF8, and xxxRaw which just accepts a byte[] directly, allowing external handling of encoding issues.

e.g. PgpSecretKey.ExtractPrivateKeyUtf8 and PgpSecretKey.ExtractPrivateKeyRaw

from bc-csharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.