Fwd: ClearSign signatures and required carriage return at the end
Dominic Gendron <[email protected]>
| Newsgroups | gmane.comp.encryption.bouncy-castle.devel |
|---|---|
| Message-ID | <CACYDu6jxqcE+PcXTv8v7Ttj_CXGc09Kn-no4EB0LqaZYrRhaKQ@mail.gmail.com> |
-------------------------------------------------------------- From: Dominic Gendron <c <[email protected]>[email protected]> To: [email protected] Subject: ClearSign signatures and required carriage return at the end Hello, I try to create to apply a ClearSign signature on a text file using the ClearSignedFileProcessor example included with the .Net BouncyCastle source code. If I try to sign a text file containing the value "Hello World" and it generates the following content at the end of my message. The problem I live is that the "BEGIN PGP SIGNED MESSAGE" label is on the same line as the text content I try to sign. When I try to verify the signature using the VerifyFile() method, a null value is returned on the following line of the ClearSignedFileProcessor/VerifyFile(). The null problem is simply caused by the bad structure of the file generated by the Sign() method. PgpSignatureList p3 = (PgpSignatureList) pgpFact.NextPgpObject(); Caused by --> Hello World-----BEGIN PGP SIGNATURE----- Actually I have 2 "solutions" to avoid this problem : 1. Always have a \r\n at the end of every file I want to sign : "Hello World\r\n". 2. Inside the Sign() method, adding manually the \r\n to always ensure it will be present ProcessLine(armoredOutputStream, pgpSignatureGenerator, new byte[] { 13, 10 }); armoredOutputStream.EndClearText(); The problem about each of these solutions is that it alters the original content to sign... We actually have to respect a government quality test where they expect to get from us the precise text "Hello World" signed, then encrypted. After that they verify if they obtain the same result on their side by decrypting/unsigning using Symantec PGP. If I use the 2 proposed solutions I the 2 results will be different because of the new \r\n added and I suppose we will fail the goverrnment test. (different checksum) Message to send : "Hello Word" Message they will receive : Hello World\r\n" I unit tested the ClearSignedFileProcessor and even if the message is similar ... they are not equals. Hope you can help me ... could it be an improvement to make to the BouncyCastle library ? Regards. Dominic Note : I searched on the Net before posting here and found out interesting past answers on this forum, but even if it gave me more information, it did not completly solved by problem. http://bouncy-castle.1462172.n4.nabble.com/Problem-with-openpgp-examples-ClearSignedFileProcessor-td4656903.html http://bouncy-castle.1462172.n4.nabble.com/problems-with-BEGIN-and-END-signature-td4450682.html Sample behavior I encounter : -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello World-----BEGIN PGP SIGNATURE----- Version: BCPG C# v1.8.3.0 iKYEAQECABAFAlu0xTkJHHVzZXJuYW1lAAoJEP13OYhS4wamzVsD/jdNYCWrpaE1 G4N50OA0rLxjYV5//8VbR7s9gtEVADrPM+wSLXVbLct2MY3ZLBrgBJ1rJs6WkdJB k33qE+dXbzwfR+o9AXP7tGRgKGO6hifllpRQxSJifjQ6ukZKPSwmopm0PwmOPHib rYuUwBHuu7MSoKvVosk28USHS/7IlNa0 =LPnd -----END PGP SIGNATURE----- --------------------------------------------------------------