# Encryption/Decryption of a string

**URL:** <https://forum.kirupa.com/t/encryption-decryption-of-a-string/298414>\
**Category:** flash\
**Created:** [October 18, 2009, 5:41pm UTC](https://forum.kirupa.com/t/encryption-decryption-of-a-string/298414 "2009-10-18T17:41:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![minopharma](https://avatars.discourse-cdn.com/v4/letter/m/a9adbd/32.png) [@minopharma](https://forum.kirupa.com/u/minopharma)\
**Post date:** [October 18, 2009, 5:41pm UTC](https://forum.kirupa.com/t/encryption-decryption-of-a-string/298414/1 "2009-10-18T17:41:37Z")

</div>

Hi,  
I’m using as3crypto classes for encryption/decryption of a string. The encryption is ok (I’m using the following encryption method):

```auto

var cut:ByteArray = new ByteArray(); 
cut.writeUTFBytes(iutime); 
var key:ByteArray = new ByteArray(); 
var random:Random = new Random(); 
random.nextBytes(key, 8); 
var aes:ICipher = Crypto.getCipher("blowfish-ecb", key, Crypto.getPad("pkcs5"));
aes.encrypt(cut); 

```

Now, I’m trying to decrypt the encrypted string using the same method, but I can’t and I don’t know why. Every time I’m debugging my air application I’m receiving an error (something about the decrypt() and IPad).  
Can you help me to solve this problem? How to use the same method to decrypt?  
Thanks in advance,  
minopharma
