×

Discussion Board

Page 2 of 2 FirstFirst 12
Results 16 to 27 of 27
  1. #16
    Super Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,559

    Re: crypting with J2ME decrypting with PHP

    You are posting code to send an SMS. Did you really write it yourself, or have you just copied that from somewhere else without understanding what it does or is supposed to do? That piece of code has nothing whatsoever to do with encryption/decryption, nor does it have anything to do with sending data to a server using PHP, which is what you've claimed is your actual goal.

    I suggest you talk to your professor, show him what you've written here, what replies you've received, and ask if your professor can recommend you some extra tutoring or a change of project, or field of study.

  2. #17
    Registered User
    Join Date
    Jul 2012
    Location
    South America
    Posts
    43

    Re: crypting with J2ME decrypting with PHP

    sir im so sorry but its hard for me to encrypt the data and to decrypt it i just want a tutorial?
    because i don't know on how to encrypt the message then it will send to the server of our school that's
    why i need a very simple standard encrypter in j2me and how can i do this ..

    thankx

  3. #18
    Super Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,559

    Re: crypting with J2ME decrypting with PHP

    Quote Originally Posted by AnorEnaj2330 View Post
    sir im so sorry but its hard for me to encrypt the data and to decrypt it i just want a tutorial?
    because i don't know on how to encrypt the message then it will send to the server of our school that's
    why i need a very simple standard encrypter in j2me and how can i do this ..
    You have already the simplest possible (more or less) encryption and decryption code in post #4 in this thread.

    Here are the steps you need to take:

    1. If you need to send data to a server, stop playing around with irrelevant SMS examples, but take one of the existing HTTP examples in the wiki (which already have been pointed to you in your other threads), and first make that example work with your server side code, so that you know how to send data to a server, and you know how to receive it on the server side.

    2. Once sending data to the server works (i.e. what you wish to send in clear, unencrypted form is received correctly on the server), then use the encryption code in #4 to encrypt the data before sending, and make sure the server receives it.

    3. When the server can receive the encrypted data (check that the encrypted data looks/is the same on the phone, and the server side), add the PHP decryption step before you try to use the data on the server.

  4. #19
    Registered User
    Join Date
    Jul 2012
    Location
    South America
    Posts
    43

    Re: crypting with J2ME decrypting with PHP

    sir ive got this error ...

    i'll try that code .

    symbol : method encode(byte[])
    location: class hello.Base64
    return new String(Base64.encode(result));


    symbol : method doFinal(byte[],int)
    location: class hello.PaddedBufferedBlockCipher
    bfCipher.doFinal(result, len);



    ive got that error)

    what should i do with that ?

    thanks

  5. #20
    Super Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,559

    Re: crypting with J2ME decrypting with PHP

    Why are you not using/trying the code in #4 as it seems to be complete functions (one function for you to call to encrypt the data and another function to decrypt the data) with a fixed key?

    If all you have tried is the few lines you posted, it is not something that'll compile to anything useful at all; it is not a complete application or even comple function/class, or anything, really.

    And when ever you have compilation problems, "that error" is not very helpful as far as descriptions go. Post the actual compiler error messages with line numbers, and complete code (not just a few isolated lines), as well as information as to which development environment and SDK you are trying to use.

    Let's start with really elementary stuff...

    Do you have a working J2ME build environment where you can actually compile and run, e.g., some "Hello World" application successfully in the emulator?

    If you have, which tools and SDKs are you using? NetBeans? Eclipse? Something else?

    If do not have a working environment, start by going through this "Getting Started" guide all the way until you manage to do the last "Run your app on a phone" step, too: https://www.developer.nokia.com/Deve...rted/NetBeans/

    If you can't build and run a complete, ready-made example application, trying to do anything more advanced is not going to be possible. You have to learn to walk, before you can run.

  6. #21
    Registered User
    Join Date
    Jul 2012
    Location
    South America
    Posts
    43

    Re: crypting with J2ME decrypting with PHP

    sir hi again

    before, we had a project in j2me that can store in rms and send data...

    i already passed it and my grade is 98%
    then

    my professor gave me a new task it's all about
    encrypt / decrypt the sms in using standard encrypter that can use in all possible applications.

    sir i know on how to use j2me even though im a new programmer in j2me
    then im so worried for this time for that task
    the encryption and decryption

    sir i have my form " registration "

    and the form registration have a textfields.

    like
    NAME:
    ADDRESS:
    BIRTHDAY:


    and there' a comman button "SEND"

    all i need when i click the send the data will automatically send and it was encrypted


    then my professor want it when i send it to our server it is encrypted
    the mesage that i will send to him is encrypted
    im so disgusted. with this task

    because i dont know how to use

    bouncy castle.
    DES
    AES
    CIPHER
    BLOWFISH

    is that there is an installer for me to installed so that i can use it already??



    thats why im so problematic

    sir please help me ..

    i dont know what is the use of
    blowfish cipher??

    for what is that ..

    can you please help me ..


    what standard and is that easy ?

    thanks in regard.

  7. #22
    Super Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,559

    Re: crypting with J2ME decrypting with PHP

    Take your existing code, include the functions and declarations from #4, and then call encryptText() passing it the encryption key and the text string you wish to encrypt, and send the string returned by encryptText() instead of the original text.

  8. #23
    Registered User
    Join Date
    Jul 2012
    Location
    South America
    Posts
    43

    Re: crypting with J2ME decrypting with PHP

    thank you for that
    Mr.Petrib ??

    what can I use blowfish or bouncy castle?
    what is more easier ?



    the flow of the program

    hello sir good day !!
    can you please guide me in this problem sir ??
    im a j2me programmer

    i have my form in my emulator named " REGISTRATION"
    then it have a textfields

    example
    NAME:
    ADDRESS:
    AGE:

    something like that
    then i have my button " SEND "
    all i want is if i click the button send
    the data that inserted in that field

    example
    NAME:Sushmita takeyi
    ADDRESS:South korea
    AGE:35 years old

    the high lighten color red
    will be sent to the receiver but that data is secured and
    it is encrypted when the receiver received it.


    sir is the bouncy castle is for a code or installer.
    thanks in regard. !!
    Last edited by AnorEnaj2330; 2012-10-03 at 02:17.

  9. #24
    Super Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,559

    Re: crypting with J2ME decrypting with PHP

    Quote Originally Posted by AnorEnaj2330 View Post
    what can I use blowfish or bouncy castle?
    Use the code/functions from #4.


    Quote Originally Posted by AnorEnaj2330 View Post
    what is more easier ?
    It really can't get much more easier/simpler, it seems, than than using the code in #4 as all you need to do is to add it to your existing code as I outlined for you in #22.


    Quote Originally Posted by AnorEnaj2330 View Post
    im a j2me programmer
    Hmmm.

  10. #25
    Registered User
    Join Date
    Jul 2012
    Location
    South America
    Posts
    43

    Re: crypting with J2ME decrypting with PHP

    sir i have my error

    :\Users\Network Admin\Documents\NetBeansProjects\CryptoTest\nbproject\build-impl.xml:782: Execution failed with error code 1.
    BUILD FAILED (total time: 1 minute 11 seconds)

  11. #26
    Super Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,559

    Re: crypting with J2ME decrypting with PHP

    Quote Originally Posted by AnorEnaj2330 View Post
    sir i have my error

    :\Users\Network Admin\Documents\NetBeansProjects\CryptoTest\nbproject\build-impl.xml:782: Execution failed with error code 1.
    BUILD FAILED (total time: 1 minute 11 seconds)
    Have you tried this already? http://www.lmgtfy.com/?q=execution+f...h+error+code+1

  12. #27
    Registered User
    Join Date
    Jul 2012
    Location
    South America
    Posts
    43

    Re: crypting with J2ME decrypting with PHP

    this is my code for
    encrypting

    public void encrypt(String textToEnrypt, String keyString) {
    Cipher cipher;
    try {
    cipher = Cipher.getInstance("DES");
    } catch (Exception ex) {
    System.out.println(ex.toString());
    return;
    }

    byte[] keyData = keyString.getBytes();
    SecretKeySpec key = new SecretKeySpec(keyData, 0, keyData.length, "DES");

    try {
    cipher.init(Cipher.ENCRYPT_MODE, key);
    } catch (Exception ex) {
    System.out.println(ex.toString());
    return;
    }

    int cypheredBytes = 0;

    byte[] inputBytes;
    try {
    inputBytes = textToEnrypt.getBytes("UTF-8");
    // inputBytes = textToEnrypt.getBytes();
    } catch (Exception ex) {
    System.out.println(ex.toString());
    return;
    }

    byte[] outputBytes = new byte[100];

    try {
    cypheredBytes = cipher.doFinal(inputBytes, 0, inputBytes.length,
    outputBytes, 0);
    } catch (Exception ex) {
    System.out.println(ex.toString());
    return;
    }

    String str = new String(outputBytes, 0, cypheredBytes);
    buffer = str;
    System.out.println("Encrypted string = " + str);
    }

    i need to insert this codes in command
    is this possible ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×