> Author: kuemmel
> Date: Sat Jul 17 14:26:11 2010
> New Revision: 34931
> URL: http://www.lyx.org/trac/changeset/34931
> 
> Log:
> add first version of .lyx file encryption. It's disabled by default and could 
> out-of-the-box only by compiled on Linux with cmake and with openssl-devel 
> packeges.
> 
>  /*!
> + * \var lyx::FuncCode lyx::LFUN_BUFFER_WRITE_ENCRYPTED
> + * \li Action: Saves the current buffer encyrpted.
typo
> + * \li Notion: Saves the current buffer encyrpted to disk, asks for a new 
> filename
typo
> + * \li Syntax: buffer-write-encyrypted

-typo
-Origin: is missing

> +     case LFUN_BUFFER_WRITE_ENCRYPTED:
> +             enable = doc_buffer;

here should be something like
ifndef encryption
lfun.setflags(off);
#endif

which will remove it from menu, so you dont have to care about 
commenting/uncommenting
line in menu.ui file.


> +             Alert::error(_("Encryption"), _("This LyX program is to old to 
> read encrypted file."));

typo "too"

> +     if (defile.open(QIODevice::WriteOnly)) {
> +             defile.write(decrypted);
> +     }
> +
> +     return tempDecrypted;
> +}
> +
>  
> -Buffer * GuiView::loadDocument(FileName const & filename, bool tolastfiles)
> +Buffer * GuiView::loadDocument(FileName const & filenameIn, bool tolastfiles)
>  {
>       setBusy(true);
>  
> +     FileName filename = decryptedFileName(filenameIn);
> +

i wonder what happen if lyx2lyx comes to such file.

> +             case LFUN_BUFFER_WRITE_ENCRYPTED:
> +                     LASSERT(doc_buffer, break);
> +                     saveBufferEncrypted(*doc_buffer);
> +                     break;
> +

one problem might be that user can think that its saves also all related stuff 
around,
just think about all the tmp files.figs etc. this can be solved by warning with
'don't show again' check box.

also he could think that opening encrypted file means that new save is encypted
by default. should we change the extension?

> ==============================================================================
> --- /dev/null 00:00:00 1970   (empty, because file is newly added)
> +++ lyx-devel/trunk/src/support/CryptographicEncryption.cpp   Sat Jul 17 
> 14:26:11 2010        (r34931)
> @@ -0,0 +1,182 @@
> +// -*- C++ -*-
> +/**
> + * \file CryptographicEncryption.h
> + * This file is part of LyX, the document processor.
> + * Licence details can be found in the file COPYING.
> + *
> + * \author Peter Kümmel
> + *
> + * Full author contact details are available in file CREDITS.
> + */
> +
> +#include <config.h>
> +
> +#include "CryptographicEncryption.h"
> +
> +#include <QDataStream>
> +
> +
> +#ifdef LYX_ENCRYPTION
> +#include <openssl/aes.h>
> +#include <openssl/evp.h>
> +#endif

if its question of just one routine we could include it and get rid
of openssh dependence...

> +bool CryptographicEncryption::encyrpt(QByteArray const & plain, QByteArray* 
> encrypted, QByteArray const & key)

"encrypt"

> +bool CryptographicEncryption::decyrpt(QByteArray const & encrypted, 
> QByteArray* plain, QByteArray const & key)

"decrypt"

> +     bool encyrpt(QByteArray const & plain, QByteArray * encrypted, 
> QByteArray const & key);
> +     bool decyrpt(QByteArray const & encrypted, QByteArray * plain, 
> QByteArray const & key);
as above


pavel

Reply via email to