On Thu, 12 Dec 2002 22:33:01 +0100 (Romance Standard Time) Vadim Zeitlin 
<[EMAIL PROTECTED]> wrote:

> On Thu, 12 Dec 2002 09:37:13 +0100 Xavier Nodet <[EMAIL PROTECTED]> wrote:

> XN> Actually, I am now able to verify PGP/MIME signatures... But this is not
> XN> nice at all: I pop-up a warning to display the results,

>  Normally you should insert a PGPClickable into the viewer just as the
> view filter does.

Of course! I had not realized that I had the viewer instance immediately
available as m_viewer...

> How to do it withotu duplicating the code is a good
> question however.

I don't really think that there is so much duplicated code...
VerifySignature and VerifyDetachedSignature share ExecCommand. Finding
if the message is signed, and which parts to feed GPG with, is obviously
not the same for PGP/MIME and ASCII Armor.

The only thing that should be common but is not at this time is what we
do after the checking: displaying the result. I will try to devise a way
to share this code. Some virtual MessageViewer::displaySignedPart(), to
which would be given all the necessary stuff to know what to do exactly?

> XN> I believe we should have a much better way to show those signature
> XN> verifications. One thing in particular, is that it should be very clear
> XN> which parts of the message were actually signed. I was thinking to
> XN> something like 'boxing' the signed part:

>  It would be nice but I don't really know how to do it... Of course, we can
> have the pure virtual StartBox()/EndBox() in the viewer class -- this
> doesn't cost much. But how to implement them?

Something like this, perhaps...

class TextViewer {
private:
  unsigned int m_boxedLevel = 0;
  void prependBoxes();

public:
  void StartBox(String message = _T(""));
  void EndBox(String message = _T(""));
};

TextViewer::StartBox(String message) {
  prependBoxes();
  m_boxedLevel++;
  print " /---" << message << "---" << endl;
  print "/" << endl;
}

TextViewer::EndBox(String message) {
  prependBoxes();
  assert(m_boxedLevel > 0);
  m_boxedLevel--;
  print "\" << endl;
  print " \---" << message << "---" << endl;
}

TextViewer::prependBoxes() {
  for (int i = 0; i < m_boxedLevel; ++i)
  {
    print "| ";
  }
}

Plus making sure that before printing any line, prependBoxes() is
called...

This could give

 /--- Good PGP signature by "Xavier Nodet" ---
/
| Here is the signed part of my message
| This photo is also signed.
|
| [Attachment: PC081491.JPG : IMAGE/JPEG, 91422 bytes]
\
 \------

Given the fact that we do not have to deal with a 80 column consoles,
prepending a few chars to each line seems correct to me.

Yes, I really like that...

> XN> This seems to me particularly important for MIME messages: attachements
> XN> can be signed or not: this should be prominent.

>  We could include the list of signed message parts in the "details" window
> of the PGP signature.

This will not do for ASCII armor, where it will not be easy to state
exactly where the signed text starts and end. BTW, ASCII armor signature
detection code could (should?) be recursive...

> XN> The problem is that there are two very different parts of the program
> XN> that deal with signature verification: MIME parsing, and text display.

Actually, this is not so much of a problem, as I explained above.

> XN> > [the PGPEngine intance should be created on demand]
> XN> 
> XN> I am not against that, but why do you insist on creating on demand? It
> XN> is not so heavy a class, is it?

>  It might be not or it might be, but M startup time is already quite long

Actually, I do not start M so often! ;)  It is rather always on...

> and it shouldn't become any longer -- especially if it is to initialize
> some feature which the user has all chances of not even suspecting about
> (not everyone uses PGP).

Correct.

> Someone has to delete this pointer [to the PGPEngine instance]... Of
> course we can simply insert one line in MApp::Shutdown() and forget
> about it but it would be nice to have a more generic way of dealing
> with this.

A list of pointers to global instances of such classes? With a way to
get (and automatically create) them, and a way to delete them, all that
done by giving a String to refer to the class, and everything is deleted
during shutdown?

-- 
Xavier Nodet
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety." - Benjamin Franklin, 1759.




-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility 
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/
_______________________________________________
Mahogany-Developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-developers

Reply via email to