Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8106677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:32:05+00:00 2026-06-06T00:32:05+00:00

This is a basic security app and i just want to encrypt & decry-pt

  • 0

This is a basic security app and i just want to encrypt & decry-pt some data now my problem is after displaying the cyber text in text box and getting back that text then after converting it into a byte array and while decryption i am getting the error

Error: ECB mode cipher length must be a multiple of blocksize 16
    at com.hurlant.crypto.symmetric::ECBMode/decrypt()

this is security.mxml

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <fx:Script>
        <![CDATA[
            import com.hurlant.crypto.Crypto;
            import com.hurlant.crypto.prng.Random;
            import com.hurlant.crypto.symmetric.ICipher;
            import com.hurlant.util.Base64;
            import com.hurlant.util.Hex;
            import com.security.AesKeyGen;
            import com.security.EncryptionKeyGen;

            import mx.utils.Base64Decoder;
            public var mytest:String;
            private var kdata:ByteArray = new ByteArray();
            private var cleartextBytes:ByteArray = new ByteArray();
            private function encryptedSave():void
            {
                //create or retrieve the current shared object
                var so:SharedObject = SharedObject.getLocal("encryptedStore");

                //generate a random key

                var ec:EncryptionKeyGen = new EncryptionKeyGen();
                kdata=//some plaine text converted to byte array or some byte array
                trace(kdata);
                //store our data to encrypt into a ByteArray

                cleartextBytes.writeUTFBytes(plainText.text);

                var aes:ICipher = Crypto.getCipher("aes-ecb", kdata, Crypto.getPad("pkcs5"));

                aes.encrypt(cleartextBytes);
                trace("after Encription-------------"+cleartextBytes.length+cleartextBytes);

            }

            private function encryptedLoad():void
            {cleartextBytes=new ByteArray();
                cleartextBytes.writeUTFBytes(cyperText.text);
                                 trace(cleartextBytes +"-------------"+cleartextBytes.length);
                var aes:ICipher = Crypto.getCipher("aes-ecb", kdata, Crypto.getPad("pkcs5"));

                aes.decrypt(cleartextBytes);

            }
        ]]>
    </fx:Script>

    <mx:Panel width="600" height="400" title="FlexEncryptionExample1">
        <mx:Form width="100%">
            <mx:FormHeading label="Stored WebService credentials"/>
            <mx:FormItem label="User: " width="100%">
                <mx:TextInput id="plainText" width="100%"/>
            </mx:FormItem>
            <mx:FormItem label="CyperText: " width="100%">
                <mx:TextInput id="cyperText" width="100%"/>
            </mx:FormItem>
            <mx:FormItem label="plainText2: " width="100%">
                <mx:TextInput id="plainText2"  width="100%"/>
            </mx:FormItem>
            <s:Label text="" id="encryptedText" visible="false"/>
        </mx:Form>
        <mx:HBox width="100%" horizontalAlign="center" verticalAlign="bottom">
            <mx:Button label="Save" click="encryptedSave()"/>
            <mx:Button label="Load" click="encryptedLoad()"/>
        </mx:HBox>
    </mx:Panel>
</s:Application>

Anybody please can help me Thank you…..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T00:32:07+00:00Added an answer on June 6, 2026 at 12:32 am

    After Aes Encryption while converting into string i added following code and finally all the things went correct………

                aes.encrypt(cleartextBytes);
                trace("after Encription-------------"+cleartextBytes.length+cleartextBytes);
                cleartextBytes.position=0;
                var myEncoder:Base64Encoder = new Base64Encoder();
    
                myEncoder.encodeBytes(cleartextBytes);
    
                cyperText.text=myEncoder.toString();
    
                trace("Encoded string length"+cyperText.text.length);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What I want to do is implement some basic security by checking not only
This basic app which was given to me as an project should run quite
i know this is basic but somehow i have been stuck here for some
I am working on a seemingly basic mobile app (first). But I want to
I'm looking to add some basic security to an Access .MDB. What I'd like
Updated Question After some further debugging I've updated this question to be more accurate
We have a few existing web services which require some sort of basic security
I'm doing some functional testing in my Symfony2 app, and want to assert controller
Im getting this error: FileLoaderLoadException: Cannot import resource app/config/security.yml from /app/config/config.yml. The file security.yml
I've created this basic 3D Demo using OpenGL/SDL. I handled the keyboard callback so

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.