On the BlockDecryptor class.

Hello

I need to encrypt the string using AES encryption and CBC mode.

I have tried everything first how written in one of the post "how - use basic encryption. This code works fine.

But when I encrypt the string using blockdescryptor and CBCBlockDescryptor, the string is fully encrypted.

How can I encrypt the string correctly?

Here is the code:

private static ubyte [] encrypt (byte [] keyData, byte [] data) throws IOException, CryptoException

{

Create the AES key to use for data encryption.

This will create an AES key using as many keyData
as possible.
Key AESKey = new AESKey (keyData, 0, 128);

Now, we want to encrypt the data.
First, create the cipher engine that we use for the real
data encryption.
Engine AESEncryptorEngine = new AESEncryptorEngine (key);

String strInitVector = "1234567890123456";
Byte [] initVector = strInitVector.getBytes ();
        
Create a new initialization vector by using 8 bytes in initVector
IV InitializationVector = new InitializationVector (initVector);
        
Create a BlockEncryptor to hide the details of the engine away.
ByteArrayOutputStream output = new ByteArrayOutputStream();
Cipher BlockEncryptor = new BlockEncryptor (new CBCEncryptorEngine (engine, iv), output);
BlockEncryptor cipher = new BlockEncryptor (fengine, output);
        
Encryptor.Write (data, 0, data.length);
        
int nSize = output.size ();
Encryptor.Flush ();
        
output. Close();
Encryptor.Close ();    This application line starts an untrapped exception

Now, the figures are sitting in the ByteArrayOutputStream.
We just want to recover.
Return output.toByteArray ();
}

I also noticed that the inputbuffer for BlockEncryptor has the real is12 given and inputoffset.

Please help me.

Kind regards

Shubhangi

Hello

Thanks for the quick response.

I have tried the same thing, added byte '0' at the end of the string if the length of the string is less than the length of block.

This works perfectly.

Thank you.

Kind regards

Shubhangi

Tags: BlackBerry Developers

Similar Questions

  • Error "Failed to initialize the raid class" on Equium A100

    Hello peeps

    I seem to have a problem re install the Vista 32 bit product supplied with my A100 - 02L recovery disk. I get a message "unable to initialize the raid class."

    Any ideas of what the problem may be Pls?

    Hi Bfab,

    When you get this error message exactly? You see that at the end of the installation during installation or recovery?

    I used the disk recovery from my laptop, very often, but never had a problem with it. It s still works correctly.
    If recovery disk doesn't work, it could be a malfunction of the equipment.

    Have you tested a normal disc of Microsoft Vista too?

  • Watch does not recognize the weight class as exercise-how can you add the duration of activity manually because none of the presets eg elliptical etc. is appropriate. Also does not count calories for example 35 when the rest of the group is around 500

    Look does not recognize the weight class as exercise-how can you add the duration of activity manually because none of the presets etc for example elliptical is appropriate and therefore do not count toward the daily goal. Also does not count calories for example 35 when the average of the others in the group is around 500.

    Hello

    When you use the application of the training session, choose the type of activity that best fits your business. For anything else - like weight - select the other category.

    During the follow-up of one year to the next helps:

    • Activity app will credit the ring of progress of exercise with one minute for every minute of the workout.
    • Active calories will be based on the data recorded by the heart rate sensor or a brisk walk, whichever is greater.

    Note, however, that the heart rate sensor is likely to give better results for the workouts that involve rhythmic (for example running) rather than the irregular movements.

    More information:

    Use of the workout on your Apple Watch - Apple Support

  • With the help of the child in the executable class

    I'm kinda stuck and don't know how to solve and could not find a solution online.

    I have a parent class and its children to the class. The child class only overrides a method, but not the run method. I want to compile the executable project, where the run method is called, but the class type is the child, not parent. How to do this?

    I tried three things, but all in vain:

    (1) in the build properties when I select start VI the run method of the parent, I get in the executable the parent, not the child's class class. It's logical. However, I couldn't find the option to use the child as a type's class.

    (2) when I add the run method of the child class and appeal to parents, I get two windows pop up. The run of the parent and the child method. Too many. Even if for the class child run method (see below the block diagram of a child, red run method's parent), I put not to show the façade when it is called in the properties of VI.

    (3) when I tried with a separate VI calling the run method of the parent class, but the class type is the child, I get the façade of this separate VI and the run method of the parent. See below (Blue class is child, red of parent).

    In both cases 2 and 3, I chose to put the checkbox 'See the façade when it is called' a FAKE, but still the front panels appear.

    Someone don't know either: i) the use in the executable version of the options to generate an executable when a different class method is used, or ii) when you compile an executable file with a certain start VI, to not show this starting VI?

    I understand if I say "you want to configure the RUN method of the class as 'start-up VI' in the EXE file, but it should run the RUN method for a child object"?

    If this is correct, your third approach is the right one. This new boot VI is often used as 'Splash Screen' that covers the task of a demon "spawning" for your application.

    You must simply close this VI once it's over. This can be done using VI server on its own front panel functions.

    hope this helps,

    Norbert

  • Substitution of the class, how to create the child class and then the base class

    I started to write a program for a DMM smart, that the problem is all versions of DMM greet the change company communication.

    My idea is to write a child class for each version, DMM and each Subvi child will replace the Subvi base class.

    My problem is, I first want to create a child class and after I see everything is working, start creating the base class. in this way, I'll see if think the right way.

    My question is

    How can I create a child class and then create the base class and configure the Subvi class of the child to be the substitution of the base class?

    I tried searching in the property of the class, but I don't see anything.

    Thank you

    This can be done and I did on occasion.

    You create the base class with the methods of dynamic distribution, you need (Connector components must be identical to those of the class of the child).

    Set then the legacy of the class inherits this base class.  If your method is defined as a dynamic distribution method in the parent, you will probably now have some errors (unless your method of child was already DD, in which case you might be OK already).

    To change the inheritance of a class, right-click on the properties of the class in your project, and then select Properties.  According to me, the tree of estate is at the lower end of the property.  Click on the 'legacy of change' (or something similar) to choose the class from which you now want to inherit.

  • Summary of functions (two entries) for classes of brother with a dynamic distribution of entry: the static entry retains the type of the parent class.

    Suppose that in a hypothetical example, I have a superclass (number) with two children (real and complex) classes.

    I would define a function of sum for these classes, using dynamic distribution.

    Real or complex would have its own method of the sum (VI) which would be subject to various operations, such as the real and complex numbers are different.

    As I understand it, the normal way to proceed in OOP is for each of these methods to have an entry of dynamic distribution and a static entry of its own type.

    Problem: Labview doesn't let me do this!

    I first define an input method dynamic-shipping dummy for the numberof the parent class, but only the first entry can be dynamic-Envoy while the other is statically typed as number.

    Then, when I create override methods in my two children classes real and complex, the second entry (static) remains under the number (the type of the parent class). This is not fair, because then I can't access the private data of the child class of type real or complex that will be connected to the second input (static).

    What is the solution to this problem (usually)?

    I think that, in LVOOP, you use only a dynamic terminal or a static terminal to the terminal object.

    You can have several other terminals, but all the dynamics VI (methods with the same name) must have the same API (terminals).

    If you have to understand your preferred mode to pass, use multiple terminals, not used by each method, or use a cluster that contains all the numbers to pass (real or complex, both of which are not used in each method) or you can try a Variant, as shown.

  • LVOOP: Common accessor for the child classes?

    I am reletively new to LVOOP and OBJECT oriented programming in general. I used very simple classes as a replacement for clusters several times, and now I have an architecture intended to convert most of my code into classes, dynamic distribution screw and similar.

    However, I run in to an issue, which basically boils down to laziness: I really don't want to do a lot of the same dynamic send screws I want to have a VI parent to be able to write a piece of data common to all children. Preference gives an error if the child does not have this data element.

    I guess it's quite similar to dynamic distribution, but without having to write a DD VI for each class.

    Is it possible to have the VI parent to access the data of the child? If so, how?

    Here is an example of my hierarchy:

    Test.lvclass (parent)

    DC_test.lvlcass (data: test number, 2D, time stampresults)

    Transfer_Curve_test.lvlcass (data: results of tests settings, 1 d, timestamp)

    Breakdown_test.lvlcass (data: test number, 3D, timestampresults)

    ... 28 another test

    As you can see, the data type only common between them is the timestamp. I want to be able to use a VI in the parent class to write data in the child class.

    You have it backwards autour.

    The data that is common belongs to the parent class, not the class of the child.

    Data that are not common may not be processed by the parent class and must be transformed by the child class.

    You don't need to CREATE truly dynamic shipping screws for a common data type.  If you just don't set the VI at all, it will be called the parent instance.

    Shane.

  • Prevent the child class dependency when the conditional use disable to specify the class in the development environment

    Hello

    I develop an application that I want to run on the normal systems and in real time using LabVIEW Proffesional Development System 2012 SP1

    To control how the application interacts with the user, I created a class that defines the type of user interface behavior that should allow me to have nice dialog boxes when the system is running on a machine windows and no dialog box (or any other friendly code in non-real time) if they sail on a real-time target.

    The parent class is the code that suits the actual time and the class of the child is the one with dialog boxes.

    To control the class of which it is responsible, I have a structure conditional disable. It works fine when the application is built in an executable or executable file in real time, but the problem arises when I want to use the code during development on the target in real time.

    I think that with the application under a target in real time (RT PXI), the proper case of the conditional - disable is enabled for the parent class is used, but the child classes are also listed under dependencies - I pressume it's because they exist on the block diagram in the case of persons disabled conditional turn off the diagram.

    This means that I can't deploy the code on the target in real time as it is unhappy with the class of the child code - even if it will never run.

    To save the poster my real project, I created an example with a Parent and child class and a flag to disable conditional 'class' to illustrate the problem.

    If you run Test.vi, you will see that the child class always gets locked (i.e. is addictive) while running even if it is not called.

    So - basically my question is: is what I can do about it or will I enough to disable it with conditionals and simply put the constant to correct class on the block diagram in the tests?

    Thanks in advance

    John.

    I feel your pain.  I came across something similar some time back.

    Apparently official NOR position is that you have to put a conditional structure of Disable IN EVERY ONE OF YOUR CLASS live.  In the Windows screws, you simply have a case of empty disable conditional with the windows code in another case and vice versa on the RT.

    I also much prefer the method you describe...

  • Why the parent class does not report data for child in LVOOP class?

    Attached is a practical program that I wrote to learn about the legacy with LVOOP.

    I have the impression of OOP is a Parent class describes the type of object.  Then the children inherent description of the parent.  The child may also have additional qualities, but it still contains the description of the parent.  If a child does not have a VI bearing the same name as the parent and the parent VI will be loaded and executed.

    My questions:

    (1) why does the Parent.lvclass:Read.vi not report 'Child' in the channel indicator when the child write VI has been sent?

    2) matches the data of the child, do not at all seen by the parent company even when it has the same definition (that's the String)?  I understand that the Parent do not know anything about the unique child elements, but I think we should know about the common themes which inherited the child.

    Here is my sample code:

    These are two different sets of data. The parent class has a data set containing the string, the class of the child also has a data set containing the string, but both of these channels are separated.

    This can be made apparent, by changing the names of the channels based on their respective categories:

    What you want is for your children, class VI write to access the data of the parent class. You can do this with a simple data VI member access in VI of the child:

  • Cannot use casting "to more specific class ' function to the parent class of child class

    Hello

    I am using OOP for my request for data acquisition. I have different e/s analog and digital materials. I create a superclass named DAQ.lvclass. This class has four childs: analog in out analog, digital, and Digital Out. I am trying to invoke screws of the child of the parent class's class. For that I am throwing the class parent her child to aid "to a more specific class' function. But I get the below error.

    Error 1448 occurred at the more class specific in DAQ.lvclassMain.vi AQ

    Possible reasons:

    LabVIEW: Bad type cast. LabVIEW does not deal with the run-time value of this class of LabVIEW as an instance of the given class of LabVIEW.

    How can I handle these cases where I have to call child VI of the parent member?

    I have attached two screws 1 snapshot. Main DAQ: it's the class main VI parent who manages all functions. 2. read the analog inputs: this VI trying to set the parent class for its class of the child and child vi reads value of data acquisition task. I get the second error off VI.

    Kindly help.

    Honestly, I have NO idea on what you want to do.

    Inheritance of classes in EACH OOD (object-oriented design) requires to define common ground as the parent class. Children can add things like properties and methods.

    If you set children who have no points in common, you have made a mistake.

    If all children have too many different specific methods, your OOD is absent.

    Example:

    Parent defines the method A.

    1 child adds the B method.

    Child 2 adds method C.

    But method B will not be usable on 2 children while method C will not work with 1 child.

    It is an approach that you want to prevent. In any programming language oriented OBJECT. This adds unnecessary complexity leading to difficult to maintain the code, and it is prone to errors.

    However, if you're going to do, "to more specific class ' is the correct type cast. But your screenshots and error messages, it is obvious that refine you a particular child's casting only. You must extend the code to check the real child, specifically expressed and call the method. That being said, your code increases the complexity you want to add a bunch of case of structures which essentially nihilates all THE BENEFITS of the use of OOP.

    I'm sorry to say that.

    Norbert

  • Can't place separator reference in the private class data control

    Any reason, I can't drag and drop a splitter reference leave my block diagram to a private open class data control? Basically, I'm ignored when I let it go, even if I see an icon 'drop' after that I drag the control.

    Well, I think I got smart and just placed a generic control Refnum into the command group, and then used the VI of the server class to identify it as a separator. Interesting how I could drag and drop references to the sub-panels and other types but not a divider.

  • The CCleaner registry cleaner reports "invalid or empty the file class."

    Original title: when using CCleaner (cleaning the registry), the only problem that arises is; 'Class file invalid or empty', how can I solve this problem?

    After using CCleaner, registry cleaner, CCleaner is displayed the following problem;

    Problem: Invalid or empty the file class

    Data:.tif\openWithProgids\MSPaper.Document

    Registry key: HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\fileExts\.tif\OpenWithProgids

    How can I solve this problem once and for all?

    When I use 'Registry Cleaner' "CCleaner" from the program for "chose to solve problems", it doesn't permanently solves the problem, as whenever I run the CCleaner program at a later date, it is here once again!

    I have the 32-bit version of Windows XP service pack 3 and Windows Explorer 8, is installed on this desktop computer.

    Please, help me to solve this problem.

    Thank you for any help you can give me!

    The problem with registry cleaners in general is that they often report "of the problems' when there is no problem.  If the user actually deletes an entry from the registry in response to such a notice, then it could well be a problem.

    Just because you have not known - again - a problem with the Ccleaner registry cleaning tool does not mean that you won't.  Because the 'cleansing' of the registry has not been shown to have an effect on the performance of the system, the risk of deleting something important makes use of stupid registry cleaners.  Read the two links in my previous post.

    As I wrote originally, the 'problem' reported by Ccleaner is probably due to his inability to properly manage the data type "REG_NONE" in the registry key.

    The way to fix this is to ignore and stop using Ccleaner registry that tells you that there is a 'problem '.

  • Error 1448. LVOOP: Referring to objects of the child class

    Hi all.

    In a project using LVOOP, I defined a class parent with several attributes. Of this class, there are three classes of children who inherit the attributes of the parent class and also have their own.

    Imagine that I instantiated an object belonging to the parent class and initialize its attributes. So I want this object even belong to a class of the child in particular, and refer to its attributes in the class of the child, of course, keep the values of the parent class. How can I do?

    I tried to use "in a more specific class" tool but I get the following text: "error 1448: bad type cast." LabVIEW does not deal with the run-time value of this class of LabVIEW as an instance of the given class of LabVIEW. »

    Exactly the same problem is committed and solved here http://lavag.org/topic/7473-lvoop-class-variable-as-child/, but because the links are temporarily disabled I can't download and understand the code example, which shows what it says there.

    Thank you very much
    Francisco.

    Hi Francisco,.

    Take a look at this thread: http://forums.ni.com/ni/board/message?board.id=170&message.id=362388&requireLogin=False

    Christian

  • I get the msg for the services "of the unregistered class interface.

    Whenever I try to start the windows installer, I get the msg class not registered.  What should I do?  Please help this semi-novice

    Take a look at the following:

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_vista-performance/Windows-Installer-error-80246008-COM-event/401d4a07-a69d-46FE-8748-c375a6c37e7b

  • error message "cannot load the main class.

    I ran windows update yesterday and installed the recommended updates, restarted my laptop today the error message "Unable to load the main class" appears in a box and I couldn't do anything until I had closed this box, after the loading of firefox it displays a message not responding, then a bar indicating that plugin adobe did not start successfully so I clicked to reload page Then, I rebooted my laptop to see if this solves the problem, but the same error message appeared and firefox have responded in the same way, someone has an idea how I can fix this problem?  I run anti-virus software and malware from comodo and my OS is windows vista 32. I also downloaded an update for adobe flash yesterday but the problem has not produced until after I had done the updates of windows.  Thank you

    Hello Fiona,

    Thank you for your response.

    You are facing this problem might because of Java program on your computer.

    I suggest you perform the clean boot and check the status of the issue, which will help you identify the problem.

    Keep the computer in a clean boot and check the status of the issue. If everything works well after a clean boot, you can deduce that some third-party services are at the origin of the problem. Continue with the remaining steps to pin-point on the third party service. After find you the program that is causing the problem, you will have to perhaps to update or install a newer version of the program, if you rarely use that you should consider uninstalling the software.

    How to perform a clean boot for a problem in Windows Vista, Windows 7 or Windows 8.

    http://support.Microsoft.com/kb/929135

    Note: please go through the section:How to reset the computer to start as usual after a clean boot troubleshooting section of Kb to start the computer to a normal startup after you fix the problem.

    Hope his helps.

Maybe you are looking for

  • How to create subtitles on iPad?

    Is it possible to make subtitles on iPad? I would like to create one, but since I can't access the computer I thought if there was no way to create them on my iPad. Thank you for your help

  • Why firefox fails during the upgrade?

    I have been using FF for several years. Three or 4 times during the process to upgrade FF loses open tabs and only load with a single tab (it's all right I can reopen). So, I waited for the next version 'stable' and then tried again until this succes

  • DVD for Satellite Pro 4600?

    I checked the forum and tech support for my satellite pro 4600. I remember in the past, it was possible to upgrade the standard cdr with another (CD - RW dvd or DVD - RW), dvd - rom am I looking to upgrade?Thank you!Additional information:Toshiba sat

  • Upgrade memory up to 8 GB for HP Pavilion dv6500 CTO

    I have a HP Pavilion dv6500 laptop CTO with 2 GB DIMM 2 each, 4 GB total. I have Windows 7 Ultimate 64-bit. I want to increase the power up to 8 GB or more, which makes and model of memory modules must buy?Tip: 30 2 79.2(e) QuantaThe bus clock: 800 M

  • CameraZoom FX does not seem to be save the photos full size, only photos

    Someone else there to help that this program also had the same issue? I took over 100 pictures today for work and when I was getting ready photos on my work PC that the images were not in the folder dcim on the SD card. They were, however, in the fol