[Gambas-user] Cipher
Antonio Teixeira
antonio.j.teixeira at gmail.com
Thu May 28 11:41:51 CEST 2020
Solved.
Thank you very much
Regards
António Teixeira
> Message: 3
> Date: Wed, 27 May 2020 22:05:03 +0200
> From: Tobias Boege <taboege at gmail.com>
> To: Gambas Mailing List <user at lists.gambas-basic.org>
> Subject: Re: [Gambas-user] Cipher
> Message-ID: <20200527200503.GA457647 at highrise.localdomain>
> Content-Type: text/plain; charset=us-ascii
>
> On Wed, 27 May 2020, Antonio Teixeira wrote:
> > Hi everyone,
> >
> > I am trying to use ciper with "AES-128-XTS" method but I am always
> getting
> > an error.
> >
> > hCipherText = Cipher[sAlgorithmus].Encrypt(sPlain, sKey, sInitVector)
> >
> > In my case sPlain is a string with numbers, skey is an uuid
> > ("cbfcc1173b5a4b83ae9a355079aae54c") and no mater the size of
> sInitVector I
> > always get the error : InitVector length does not match method of FMain
> in
> > line....
> >
> > Any help please?
> >
>
> The IV length for AES-128-XTS is 16 and I get no problems executing this:
>
> #!/usr/bin/env gbs3
>
> Use "gb.openssl"
>
> Public Sub Main()
> Dim sKey As String = "cbfcc1173b5a4b83ae9a355079aae54c"
> Dim sIV As String = "0123456789abcdef"
> Dim hCrypt As CipherText
>
> Print "KeyLength:", Cipher["AES-128-XTS"].KeyLength == Len(sKey)
> Print "IvLength:", Cipher["AES-128-XTS"].IvLength == Len(sIV)
> hCrypt = Cipher["AES-128-XTS"].Encrypt(Format$(Now), sKey, sIV)
> Print "CipherText:", Base64$(hCrypt.Cipher)
> Print "Decrypted:", Cipher["AES-128-XTS"].Decrypt(hCrypt)
> End
>
>
> ==========================================================================
>
> KeyLength: True
> IvLength: True
> CipherText: 6NuzSxByac+p+DD2qLuRmqpTTw==
> Decrypted: 05/27/2020 21:59:27
>
> Regards,
> Tobias
>
> --
> "There's an old saying: Don't change anything... ever!" -- Mr. Monk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20200528/fbd82048/attachment.html>
More information about the User
mailing list