oh ok, I'm so sorry.

This was really my mistake.

does it give a default crypto constant to use 256 Bit for a key and
IV?

On 11 Apr., 20:17, anno <[email protected]> wrote:
> yes thats true, i need 16 signs, but i don't think that this is is not
> the reason that have been fixed that this code doesn't work in windows
> xp but in linux.
>
> On 11 Apr., 18:41, Jeffrey Walton <[email protected]> wrote:
>
> > > Encrypt("in.txt", "chiper.dat", "123", "3124");
> > > Decrypt("chiper.dat", "out.txt", "123", "3124");
>
> > Incorrect sizes
>
> > >  byte biv[AES::DEFAULT_KEYLENGTH];
>
> > Incorrct size, but you got lucky.
>
> > Jeff
>
> > On 4/11/09, anno <[email protected]> wrote:
>
> > > Ok here is some code that someone can test it:
>
> > > #include "mainwindow.h"
>
> > > #include "ui_mainwindow.h"
>
> > > //
> > > *********************************************************************************************
>
> > > void MainWindow::Encrypt(string in_filename,
>
> > >                                                                        
> > > string out_filename,
>
> > >                                                                        
> > > string key, string iv) {
>
> > >        try {
>
> > >                StreamTransformationFilter *encryptor;
>
> > >                byte bkey[AES::DEFAULT_KEYLENGTH];
>
> > >                byte biv[AES::DEFAULT_KEYLENGTH];
>
> > >                memcpy(bkey, key.c_str(), AES::DEFAULT_KEYLENGTH);
>
> > >                memcpy(biv, iv.c_str(), AES::DEFAULT_KEYLENGTH);
>
> > >                CBC_Mode<AES>::Encryption cbc_decryptor(bkey, 
> > > sizeof(bkey), biv);
>
> > >                encryptor = new StreamTransformationFilter(cbc_decryptor, 
> > > new
> > > FileSink(out_filename.c_str()));
>
> > >                FileSource file(in_filename.c_str(), true, encryptor);
>
> > >        }
>
> > >        catch(CryptoPP::Exception &e) {
>
> > >        }
>
> > > }
>
> > > void MainWindow::Decrypt(string in_filename,
>
> > >                                                                        
> > > string out_filename,
>
> > >                                                                        
> > > string key, string iv) {
>
> > >        try {
>
> > >                StreamTransformationFilter *decryptor;
>
> > >                byte bkey[AES::DEFAULT_KEYLENGTH];
>
> > >                byte biv[AES::DEFAULT_KEYLENGTH];
>
> > >                memcpy(bkey, key.c_str(), AES::DEFAULT_KEYLENGTH);
>
> > >                memcpy(biv, iv.c_str(), AES::DEFAULT_KEYLENGTH);
>
> > >                CBC_Mode<AES>::Decryption cbc_decryptor(bkey, 
> > > sizeof(bkey), biv);
>
> > >                decryptor = new StreamTransformationFilter(cbc_decryptor, 
> > > new
> > > FileSink(out_filename.c_str()));
>
> > >                FileSource file(in_filename.c_str(), true, decryptor);
>
> > >        }
>
> > >        catch(CryptoPP::Exception &e) {
>
> > >        }
>
> > > }
>
> > > MainWindow::MainWindow(QWidget *parent)
>
> > >    : QMainWindow(parent), ui(new Ui::MainWindowClass)
>
> > > {
>
> > >                ui->setupUi(this);
>
> > >                Encrypt("in.txt", "chiper.dat", "123", "3124");
>
> > >                Decrypt("chiper.dat", "out.txt", "123", "3124");
>
> > > }
>
> > > MainWindow::~MainWindow()
>
> > > {
>
> > >    delete ui;
>
> > > }
>
> > > //
> > > *********************************************************************************************
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
-~----------~----~----~----~------~----~------~--~---

Reply via email to