Encryption on Blackberry?

I have an application developed on BlackBerry JDE 5.0.0, that encrypts a string using THE algorithm with ECB mode. After encryption, the result is encoded by base64 encoding. But when I compare the result I get my encryption method with the result I get on the cipher engine online, he always gives different results on the last character to many. I tried to decipher the result I get form my method of encryption with the engine encriptor online and it seems that the result is not that valid. So, how can I solve this different result on the last character to many?

Here my code of encryption method:

public String encryptDESECB (String text) throws MessageTooLongException
{

Byte [] input = text.getBytes ();
output byte [] = new ubyte [8];
Byte [] uid = null;
UID = "431654625bd37673e3b00359676154074a04666a".getBytes ();
DESKey key = new DESKey (uid);
Try

{

Engine DESEncryptorEngine = new DESEncryptorEngine (key);
Engine.Encrypt (input, 0, output, 0);
String x = BasicAuth.encode (new String (output));
System.out.println ("AFTER ENCODER" + x);
return new String (x);

}

catch (CryptoTokenException e)

{

return 'NULL ';

}

catch (CryptoUnsupportedOperationException e)

{

return 'NULL ';

}

}

The channel I want to encrypt is '00123456' is the result I get my encryption method: YnF2BWFV/8w = the result I get engine cipher online (http://www.tools4noobs.com/online_tools/encrypt/): YnF2BWFV9sw = the result I get Android (with the same cipher & method): YnF2BWFV9sw =

Here is the code on Android:

public static String encryptDesECB (String data)

{

Try

{

DESKeySpec keySpec is newDESKeySpec ("431654625bd37673e3b00359676154074a04666a".getBytes ("UTF8"));.

SecretKeyFactory keyFactory is SecretKeyFactory.getInstance ("DES");.
SecretKey key = keyFactory.generateSecret (keySpec);

ENCODE String plainTextPassword
Byte [] plaintext = data.getBytes ("UTF8");

Encryption cipher = Cipher.getInstance("DES/ECB/NoPadding");
Cipher.init (Cipher.ENCRYPT_MODE, Key);

Logger.log (log.info, new String (cipher.doFinal (cleartext)));

String encrypedPwd = Base64.encodeToString (cipher.doFinal (cleartext), Base64.DEFAULT);

Logger.log (log.info, encrypedPwd);

Return encrypedPwd;

}

catch (System.Exception e)

{

Logger.log (e);
Returns a null value.

}

}

Thanks for the research of Peter. I already found my mistake. It turns out my BasicAuth method is not the right one for the encoding of the encrypted string. Now I use the class a Base64 encoding and it runs very well. It produces the same string that android and online the cipher engine.

Tags: BlackBerry Developers

Similar Questions

  • Backup encryption software blackBerry with Link on Mac

    Using the link 1.1.1 build 33, on iMac with OS - X 10.8.5

    Just tried my first backup (of Q10) with link.

    He did friezer ask if I want to encrypt the backup, as Desktop software made for previous devices.

    Am I missing something? Had not used before link and want to encrypt my files p/before you begin to use the Q10 for work. (Right now, just try to familiarize themselves with the Q10 and OS10.)

    Thank you

    GeorgeB

    Hello George,.

    This option is currently not available in BlackBerry link.

    Although this feature is not supported, we appreciate your comments and will share this comment with the team produced.

    Let us know if you have any additional questions.

  • Encryption for blackBerry Smartphones

    What is the purpose of "encryption", if the unit automatically decrypts encrypted files when they are opened?

    Rolyb

    In my view, there are applications in the BlackBerry World for that (password protect specific files).

    The purpose of encryption even if the device is locked is as I said. If the card is not encrypted, it can be read. Removed from the locked unit and reading. If the device memory is not encrypted, the information can be read directly from the chip. Perhaps on the top for the typical user, but BlackBerry provides to users who need it.

  • Encryption of blackBerry Smartphones memory devices does not turn off

    I want to use blackberry protect but since I got my phone there a small lock next to the checkbox to disable encryption so I can't turn it off. I upraged to os7.1, but the problem remains. Can someone help me?

    Hello and welcome to the community!

    I'm not sure about the correlation between the encryption and the BB Protect... you jumped from one to another at whiplash speed in your post... do not understand.

    But, nevertheless, if encryption is active and locked, then the most likely answer is that your device has a COMPUTER Board policy that requires encryption is active. You can check the existence of a COMPUTER policy via this method:

    • KB30076 How to check for an it on a BlackBerry smartphone policy

    If you're on BES through your company or otherwise, you have to stop now and talk to your BES admins, because they are in control of it on your device policy.

    If you are not on BES, then somehow you got a device that once stood on BES, and who gave you sanitized it not properly before give you the device. You can now clean, but it will be totally destructive. Therefore, please begin by reviewing the Backup link in my sig auto on this post and make sure you have a full and complete backup.

    Once you have a backup, you can do this to clean your BB of the it policy:

    • KB31291 How to reset a BlackBerry smartphone to factory using BlackBerry Desktop Software Settings

    Subsequently, when you restore, DO NOT make a full restore... rather just do a selective restore of the databases you need (e.g., contacts, calendar, messages, etc.) and more precisely to avoid any database that have nothing to with COMPUTER policy, business, etc.. If you restore those, they will dutifully restore COMPUTER policy and you will be right back where you started.

    Good luck!

  • SHA256 Encryption in Blackberry

    I'm looking for SHA encrypt a string value in the BB, but some of the classes BB shows some samples which returns the length of the hMAC

    That is to say,

    private static int sampleSHA256HMAC (byte [] hashKey, text of byte [], byte [] digestData)
    throws CryptoException, IOException
    {
    Create the hash key function key
    HMACKey key = new HMACKey (hashKey);

    Create an instance of a HMAC
    HMAC hMac is new HMAC (key, new SHA256Digest());.
            
    Now, create the output stream of MAC for easy use
    MACOutputStream macStream = new MACOutputStream (hMac, null);
                    
    Write the text to the stream
    macStream.write (plain text);
            
    Copy the summary in the array of bytes digestData data and
    Returns the length of
    hMac.getMAC (digestData, 0);
    Return hMac.getLength ();
    }

    Is it possible Sha encrypt a string to return a string value (hash value) of the string as string itself.

    Hello.

    If you consider what peter_strange said to not be an encriptación algorithm and you want to continue using it, try this method. It returns a string

    private String sign(String content) throws Exception {
      HMAC sha256 = new HMAC(new HMACKey(secretAccessKey.getBytes()),
        new SHA256Digest());
      sha256.update(content.getBytes());
      byte[] signed = new byte[sha256.getLength()];
      sha256.getMAC(signed, 0);
    
      String signedbase64 = Base64OutputStream.encodeAsString(signed, 0, signed.length, false, false);
    
      return signedbase64;
    }
    

    Well, it actually returns a URLUTF8 Encoder Base64 string version but you get the idea.

    The secretAccessKey object is a string needed to chop your content. I guess that you will place your own key here.

    In summary:

    -Create the HMAC object using your key.

    -Fill with your content.

    -Create a byte [] to place the hash.

    -Complete the table with the ground content.

    -Convert the bytes to a string (I used the base-64 but I guess you could just use String (byte [])) new

    I hope it helps.

    See you soon.

  • BlackBerry Smartphones pass photos from BB to the PC

    The pictures stored in the card media on my Bold 9650 appear not on the BB desktop software to transfer them to my PC. I can see the photos on my BB. The software shows the map of media in areas of device options and shows how it is free. When I click on images in the Media Sync I get the message "no available pictures - there no pictures to import from your device.

    I also see the image files using folder in my windows management areas, but of course it is not good to copy on my PC directly because they are encrypted and cannot be opened.

    Thoughts? Thank you!

    Ahhhhh... Yes, a policy IT (which would have been my next guess, I promise you! ). If this is the case, then you need to talk to them and these KB may apply:

    • KB21172 How to remove the microSD card encryption
    • KB15244 What is Content Protection and encryption on BlackBerry smartphone
    • KB11963 How do I change the setting for the Protection of the content on the BlackBerry smartphone

    It can be much more than the it policy is limit exactly what you are trying to (copy to the PC things of the BB). You should probably talk to them before being certain of what they block, and that they do not block.

    Good luck!

  • 3DES with BB?

    Hi all

    I hope that it was a great weekend!

    Currently, I am implementing the triple encryption on blackberry. Please is there all the API calls or anything like that which could be useful for me? Everything I need to know? Any random same information would be appreciated.

    Thank you

    Dan

    http://www.BlackBerry.com/developers/docs/4.5.0api/index.html

    All classes of encryption should be here: net.rim.device.api.crypto. *.

    If she's not here, it is not available. You can see the last API (5.X) too.

  • BlackBerry 10 features and functionality we will encrypt input support?

    None of the browsers or former BlackBerry supports free SSL certificates available now at we will encrypt. Any browser on any platform supporting the real we will encrypt root certificate yet, but for now they get their cross-signed by IdenTrust certificates, which means they work in browsers more desktop and mobile, with the exception of the old Windows XP and Android (2.3.5) ones. Unfortunately even the latest browsers BB10 recognize certificates, probably because the IdenTrust root is not installed.

    I have not tried, but I suspect the we will encrypt or IdenTrust roots could be installed manually, but most of the BB10 users who may want to visit our sites safely have no idea how to install this certificate root and should not have anyway. Get the Let's encrypt root installed as a built-in root in browsers BB10 would help to achieve the goal of the Internet Security Research Group to all web sites of the encrypted world. We will encrypt will probably soon huge, does anyone know if the BlackBerry has plans to support we will encrypt or IdenTrust?

    10.3.3 BlackBerry will have confidence we will encrypt built in, but for every one who executes 10.3 - 10.3.2 you can add now we will encrypt BlackBerry 10 trust with just two clicks using my multiCERT totally free application.

    multiCERT on BlackBerry World

  • BlackBerry Z10 after upgrade 10.3.2 cannot access encrypted file of cale

    My Z10 have been encrypted. I do a custom (Config and file only, not application). I did the update to version 10.3.2 leaking. I've restored my backup. The Z10 work very well, but to see that my file but I can't open.

    You have a solution to redisplay my file?

    I perform the upgrade with the ADF. But I found a backup of my file with the link to blackberry, I found the file in my PC. I have formatted the SD and copy my file in my Z10 back. Now I back all my data. Thanks for the help

  • Related issue of encryption-decryption Leap blackBerry!

    Hello

    In Blackberry Bond can encrypt us our data twice?

    Means that if I hello.txt in the sd card before use "Setting--> security" and privacy--> encryption--> Media Card Encryption Can quantify us this txt file using some application designed by Blackberry developer means app in Blackberry World or some other developer SNAP etc.?

    I thought of the computer which is very common that twice or three times of encryption-decryption with different algorithms, maybe I'm wrong, because there is no special data used by me except songs movies & cats!

    But as a software developer, I'm curious about encryption!

    Use AES-256 encryption & according to EETimes Blackberry claim huge time to break the encryption that made by AES - 256!

    But today I read new Dutch police 'reading' Blackberry emails

    If good authority can crack the encryption, then the bad guys also do!

    His Blackberry user feeling very precarious specailly passing other manufacturers of mobile because the only reason that is 'Blackberry is security'!

    What is this opinion experts forums or views?

    The response of BlackBerry indicates that this was 'communications' are involved. Depends on communication and used security measures.

    BlackBerry has published white papers on BBM. Those that can be found. I don't know later. E-mail will depend on the employee by the two sender security measures a receiver. Communication on the other has will depend on employee safety by the app. And finally it depends on the operational safety of the users.

    My feeling is that he is a third-party application.

    In any case, Yes, if you have an application that encrypts it's own data on the device or crypt individual files, I see no reason that could not be used in conjunction with encryption devices. I don't know that it adds anything. My there are advantages and disadvantages of encryption of file by file versus encryption of the system, but that's another question.

  • BlackBerry Smartphones DTEK and device encryption must be OPTIONAL

    As far as I understand BlackBerrys intended to ensure the safety of the box, I think that DTEK and device encryption affects performance and therefore has a negative impact on customers and the user experience and lead to lower sales and higher return rates.

    BlackBerry needs to update the firmware and optional encryption of devices and security DTEK.

    Thanks for your post @Rotkaeqpchen!

    PRIV centred on the security arrangements that we can't allow a user to remove DTEK or disable encryption.

    That being said I capture your request and will share in your name with our train produced for later review. That being the case I'll mark my answer as the solution. To anyone else reading this post which is in agreement with this idea please like @Rotkaeqpchen and my post so I can understand the interest. Thank you!

  • In BLackberry AES256 encryption,

    How can I do in Blackberry AES256 encryption, I use this method but the result does not come to the standard...

    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);

    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);

    Because we cannot guarantee that the data will be a block of equal
    length, we want to use an engine (PKCS5 in this case) filling.
    PKCS5FormatterEngine fengine = new PKCS5FormatterEngine (engine);

    Create a BlockEncryptor to hide the details of the engine away.
    ByteArrayOutputStream output = new ByteArrayOutputStream();
    BlockEncryptor cipher = new BlockEncryptor (fengine, output);

    Now, all we need to do is write our data to the output stream.
    But before that, we will calculate a hash of the data as well.
    A "Digest" provides a one-way hash function to map a large amount
    data to a unique value of 20 bytes (in the case of SHA1).
    SHA1Digest digest = new SHA1Digest();
    Digest.Update (data);
    hash Byte [] = digest.getDigest ();

    Now, to write all the data and the hash to ensure that the
    data in transit has not been changed.
    Encryptor.Write (data);
    Encryptor.Write (hash);
    Encryptor.Close ();
    output. Close();

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

    Hello ezil,.

    Thanks for the reply, I also found a solution, it works fine for me

    you simply text gross and key it encrypts AES256 String

    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);

    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);

    Because we cannot guarantee that the data will be a block of equal
    length, we want to use an engine (PKCS5 in this case) filling.
    PKCS5FormatterEngine fengine = new PKCS5FormatterEngine (engine);

    Create a BlockEncryptor to hide the details of the engine away.
    ByteArrayOutputStream output = new ByteArrayOutputStream();
    BlockEncryptor cipher = new BlockEncryptor (fengine, output);

    Encryptor.Write (Data);
    Encryptor.Close ();
    output. Close();

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

  • BlackBerry 10 BB RC4 128 bit encryption browser security issues

    When you check Browserspy from your BlackBerry browser this link:

    http://BrowserSpy.dk/

    Then select 'Security' in the list

    Then select "SSL Encryption Check"

    For my Z30 I get RC4 128 bits (see photo).

    I also get the same results by using this test:

    https://www.fortify.NET/

    We're worried for RC4 128 bit security to the extent wherever Microsoft has recommended not using it.  See these two links:

    http://en.Wikipedia.org/wiki/RC4

    http://TechNet.Microsoft.com/en-us/library/cc179125.aspx

    I don't have any device to connect to the Internet with RC4 128 bit.

    Is there a way to change the encryption level or the order for the BlackBerry browser?

    (Just as a side - note because BlackBerry uses WebKit for browser (Apple uses WebKit) pick up a lot of sites Tester browser like Safari.) I woder if browser test to determine the market share does not report some of the Blackberry as Apple because of this "confusion".)

    This problem has been fixed in the new release - Version of 10.3.1.1581 software

    Now the two browser the personal side and (if you have activated BlackBerry Balance) the browser side work to connect using AES 256.

    Thanks BlackBerry!

  • BlackBerry Smartphones how decrypt data encrypted on my phone memory and my SD card

    I have encrypted my data from the device and SD card. The files that I saved on the blackberry are converted to .rem exptension.

    Now, I removed the encryption on stil devcie .but files are not converted to the original state. Encrypted files cannot be decrypted original.

    Please someone help me figure out how to decrypt the files on my Blackberry.

    See if this helps:

    http://www.BlackBerry.com/BTSC/KB31506

  • Card memory encrypted blackBerry smartphones

    Before I security wiped my blackberry pearl 9105 I removed the memory card and shortly after I put... Then he said: "a memory card has been inserted that contains encrypted files that won't be accessible by this device please place media card in the initial device to access these files... But this is the original feature: sad smiley: Someone help me please

    Nice day

    Have you back up all your files SD CARD?

Maybe you are looking for