RMI client-side - how to encrypt,decrypt  in client-side

I write javacard RMI style. My problem is...
Source code below is work when it write in applet (card - side)
but in client-side (reader -side) I copy it to client - side code and test to run, if fail --> throw exception 0x3 - javacard.security.CryptoException.NO_SUCH_ALGORITHM
It seem to be "javacardx.crypto" and "javacard.security" is make for use in applet in card only. Did I misunderstand?
if it make for use in applet only, how is possible to do like this " card use privatekey to sign message and send to reader , reader use card's publickey to verify that card sign this signature or not."
or
"card use reader's publickey to encrypt message and send to reader, then reader use privatekey to decrypt message (reader authencate itself) "
because I can't do any of cipher , keybuilder in RMI-client side(reader)
Cipher.getInstance(Cipher.ALG_RSA_PKCS1,false);
it will throw nullPointerException
and if (change false to true)
Cipher.getInstance(Cipher.ALG_RSA_PKCS1,true);
throw exception 0x3 - javacard.security.CryptoException.NO_SUCH_ALGORITHM
after that I swap this line with
pri_key = (RSAPrivateKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PRIVATE,KeyBuilder.LENGTH_RSA_512, false);
since it will do this first (i swap the line already) it also throw exception 0x3 - javacard.security.CryptoException.NO_SUCH_ALGORITHM
also be the same result with swap
kp = new KeyPair(KeyPair.ALG_RSA,(short)KeyBuilder.LENGTH_RSA_512 );
to a first line
it throw exception 0x3 - javacard.security.CryptoException.NO_SUCH_ALGORITHM
Please help me
RSAPrivateKey pri_key;
RSAPublicKey pub_key;
KeyPair kp;
Cipher RSAcipher;
RSAcipher = Cipher.getInstance(Cipher.ALG_RSA_PKCS1,false);
pri_key = (RSAPrivateKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PRIVATE,KeyBuilder.LENGTH_RSA_512, false);
pub_key =(RSAPublicKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PUBLIC,KeyBuilder.LENGTH_RSA_512, false);
kp = new KeyPair(KeyPair.ALG_RSA,(short)KeyBuilder.LENGTH_RSA_512 );
kp.genKeyPair();
          pri_key = (RSAPrivateKey) kp.getPrivate();
          pub_key = (RSAPublicKey) kp.getPublic();
//ENCRYPT
RSAcipher.init(pri_key, Cipher.MODE_ENCRYPT);
t_cipherLengthRSA = RSAcipher.doFinal(plaintxt,(short)0, (short)plaintxt.length, t_cipherText, (short)0);
//DECRYPT
RSAcipher.init(pub_key, Cipher.MODE_DECRYPT);
RSAcipher.doFinal(ciphertxt,(short)0,(short) t_cipherLengthRSA, temp1, (short)0);

I write javacard RMI style. My problem is...
Source code below is work when it write in applet (card - side)
but in client-side (reader -side) I copy it to client - side code and test to run, if fail --> throw
exception 0x3 - javacard.security.CryptoException.NO_SUCH_ALGORITHMYou can not share code between card and client. On the card use the classes of javacardx.crypto and on the client side those of javax.crypto and java.security.
It seem to be "javacardx.crypto" and "javacard.security" is make for use in applet in card only. That is right.
if it make for use in applet only, how is possible to
do like this " card use privatekey to sign message
and send to reader , reader use card's publickey to
verify that card sign this signature or not." or
"card use reader's publickey to encrypt message and
send to reader, then reader use privatekey to decrypt
message (reader authencate itself) "On each platform you have classes that provide the same cryptographic operations but the interface of these classes is different (because of the limitations of the java card platform).
because I can't do any of cipher , keybuilder in
RMI-client side(reader)Use the java.security.KeyFactory instead.
Cipher.getInstance(Cipher.ALG_RSA_PKCS1,false);
it will throw nullPointerException
and if (change false to true)
Cipher.getInstance(Cipher.ALG_RSA_PKCS1,true);
throw exception 0x3 -
javacard.security.CryptoException.NO_SUCH_ALGORITHMCryptographic support on java cards is optional. Not every card supports every algorithm. Try to use another algo.
Jan

Similar Messages

  • Hi Freinds......How to Encrypt/Decrypt Text file in j2me

    Hello friendz.,,
    I m having problem with textfile exncryption decryption in j2me..
    Can abybode tell me how to encrypt/decrypt Text file using J2ME API's.......
    PLZ help me .......
    Thanx in advance
    regards,
    Parag

    http://www.mobilefish.com/developer/bouncycastle/bouncycastle.html
    http://www-128.ibm.com/developerworks/library/j-midpds.html

  • How to encrypt/decrypt xml data into, and then out of IDS?

    Hi,
    How would we encrypt NPPI information being passed from an unencrypted xml through IDS, and then decrypt it on exit prior to Gendata.
    The IDS SDK gave a reference to IDSEncryptionRule(), but insufficient examples of implementation.
    It could be something like a single tag element, or even the entire xml, it's just not clear how to make it happen using native IDS methods.
    Any thoughts or help to implement this security measure would be most welcome!
    Thanks so much!
    Edited by: lodit on Apr 10, 2013 2:56 PM

    Hi there,
    You would need to write a custom IDS rule that implements this function. You can refer to the IDS SDK book for info on writing a custom rule. IDSEncryptionRule does operations based on the request state received. Normally when an IDS rule is executed, the rules in the request type definition are executed with the RUN_FORWARD request state. Then they are executed with the RUN_REVERSE request state. An example of why this model is used would be the ATCReceiveFile. On RUN_FOWARD, it writes the contents of file segments in a message to a temporary file. Subsequent rules execute. Then on the RUN_REVERSE, the ATCReceiveFile does clean up routines to remove the temporary file.
    So, armed with that knowledge, you can use the IDSEncryptionrule to perform on RUN_FORWARD (decrypt message variables for subsequent processing by Documaker) and then on RUN_REVERSE (encrypt message variables to send back to the client).
    It should be apparent at this point that you need to use an encryption/decryption mechanism with the IDS client otherwise you won't be able to prepare the message to send or read the response. On the client side there are functions - consult the examples included in the IDS SDK (DSI_DSK in the installer package).
    --Andy                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to encrypt/decrypt the password

    Hi
    In our website(JSP,servlet) is running over the Sun One Application server.In website, Contact us information is call by a servlet.when we submit the information and it will connect to the DB. I need to use encrypt/decrypt the password. DB connection information is store in server.xml.
    So how to proceed to encrypt/decrypt the password?
    please advice/suggestion for the same.
    thanks
    lalit
    Edited by: Lalit107 on Aug 6, 2009 4:49 AM

    I don't understand what you are saying. Is your password sumitted from the JSP?

  • How to Encrypt - Decrypt the Passwords

    Hi,
    i am developing an integration between SAP and SFTP.
    i want to save the encrypted password of SFTP to database tables and then i want to use the decrypted password to connect SFTP.
    how to convert the encrypted password to decrypted?
    can somebody help me please?
    Best regards.

    Hi
    you will have to encrypt the entered password first and compare the encrypted passwords.
    Im not sure, but maybe FM VRM_COMPUTE_MD5 will do the encrypting-job.
    just check it out and also check below FM
    Try the DB_CRYPTO_PASSWORD function module, there's no way to decrypt it back that I know of. You just pass the user input to the function module and compare the encrypted output to the value stored in the database.
    and also try this two
    Use the following FM to encrypt
    CALL FUNCTION 'FIEB_PASSWORD_ENCRYPT'
    Use the following FM to decrypt
    CALL FUNCTION 'FIEB_PASSWORD_DECRYPT'
    By these FM you can encrypt & decrypt any fields of the Program.
    Warm Regards
      NZAB

  • General Question about how to encrypt-decrypt and Digital signatures

    Hi,
    We're developing classes for encrypting and signing a txt message and for decrypting and validating the signature of the message. Everything works properly but I have several questions, they're not about code:
    1st We're encrypting the message following this way:
    -generating a number which is gonna be the password
    -encrypting the message in AES with this password
    -encrypting the with the public certificate of the receiver the password
    -We pack everything, encrypted message+ encrypted password in a File with public key of the receiver.
    The questions we have for this issue are:
    -Is it okay? or can I do it more efficiently.
    -is it a standard for developing encrypting software? We've followed java api tutorials
    -Can we decrypt this message using comercial software? it just plain text(of course if we have the private key)
    2nd We take this message and we sign it with our private key
    -We use CMS classes from bouncycastle libraries
    The questions we have for this issue are:
    - How can I check , with comercial software, whether this message is signed ok and is valid.
    - How can I know whether this way of signing is in compliance with PKCS7-CMS standard?
    Thanks in advance
    if you need more information ask me

    The file multiscreen.html apepars to do the following:
    It tests if the browser is running on a "hand held device".
       This means it looks to see if the device name includes:
              "blackberry","android","iphone","ipad","symbian","smartphone","ios","windows ce","webos"
    If the answer is Hand-held then the HTML5 published module is loaded. Otherwise it loads swf.
    I can see no check that Flash player is loaded before making the choice, nor does it check the compatability of the HTML5 on the "hand held" device. In other  words it isn't very "smart"

  • Jax-RPC Client side: How to use multiple X509 client certs ?

    hi, (excuse me for my english)
    i'm looking for an answer to this question:
    I'm using the JAX-RPC libraries (JWSDP 2.0) for a web services client application in my app server (tomcat 4 under 1.4 Sun JVM) with HTTPS connection. All works fine when i'm using system.Setproperties for keystore and trustore.
    Buk now, I want to use different client SSL keys for the same app to consume the web service (one SSL client key for a group of users).
    Is it possible ?
    i've tried using custom SSLSocketFactory and custom KeyManager but it won't works: when the SSL connection is well established once, i can connect to the app with an invalide client cert ! (it seems SSL connection is in cache and i dont't know how to disable this cache).
    I have read some threads on this problem without answers ! (http://forum.java.sun.com/thread.jspa?forumID=331&threadID=333010 and http://forum.java.sun.com/thread.jspa?forumID=331&threadID=600372)
    Thanks
    Edited by: Buck007 on May 26, 2008 9:14 AM

    I have the same problem. If you find the solution please post it here :)
    thanks

  • RMI call back - How to refer to the client project from the server project?

    Hi, I am working on an RMI assignment which basically needs me to use the RMI call back for the server to notify the clients.
    I have 2 projects , one for the client and another for the server.
    In the client project, I have a client interface and the main client class implements this interface.
    In the server project, I have a server interface and a class that implements this interface.
    I can use the server interface in the client project's code by adding the server project in the path of the client project. it lets me use the server interface in the code if I put "import.." statement.
    But the issue is I can not do the same to access the client interface from within the server project's code. Since that will be a circular reference, the compiler does not let me use the client interface from within the server's code. This is putting me in a great difficulty and I am stuck here. What should I do so that I can use the client interface and the compiler won't complain?
    Thanks for any help..
    Regards.. js

    Let me explain what I tried: I manually generated stub class of the client using the Eclipse IDE as mentioned in my previous message. The StockMSClient_Stub.class got created in my client project.
    The common project has the 2 interfaces - one from the client and one from the server.
    I have added reference to the common project from the client and server projects to use the interfaces.
    With the above mentioned in place, when I run the server project, the registry binding of the server objects is very fine. But I am getting error in the applet at the line where I am passing the client object to the method provided by the server interface. The following is the code snippet in the applet where I am getting the error.
    specifically the line: String response = objs.login(userId, password, smsClient);     ====================
    public void login() {
                Registry reg = null;
                String userId = "test";
                String password = "test";
                this.smsClient = new StockMSClient();
                try {
         reg = LocateRegistry.getRegistry(rmiHost,rmiPort);
                          UserInterface obj = (UserInterface) reg.lookup(rmiStrings
                                                                                                                        [1]);
         User u = obj.find(userId);
         if (u == null) {
              System.out.println("This user is not valid");
         } else {
                         UnicastRemoteObject.exportObject(smsClient);
         reg = LocateRegistry.getRegistry(rmiHost, rmiPort);
         LoginLogoutInterface objs = (LoginLogoutInterface) reg
                                   .lookup(rmiStrings[0]);
                        //getting error at the following line.
                        String response = objs.login(userId, password, smsClient);     
                         System.out.println("response :" + response);
               } catch (AccessException ae) {
                       System.out.println(ae);
               } catch (NotBoundException nbe) {
                      System.out.println(nbe);
               } catch (RemoteException re) {
                      System.out.println(re);
    } //end login()====================
    Error is:
    java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
         java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
         java.lang.ClassNotFoundException: sms.rmi.graphics.StockMSClient_Stub (no security manager: RMI class loader disabled)================
    I don't know why this is happening..Please help.
    thanks & regards, js
    Message was edited by:
    jsitaraman

  • How to encrypt/decrypt 4 character field in ABAP?

    Hello SDN Community,
    I have done extensive searches before posting this.  Have even explored fuction modules FIEB_PASSWD_ENCRYPT/DECRYPT.  Even looked at SSF Developers Guide - chapter 4.  The FIEB function modules were dead-end.  SSF looks like it concerns securing of documents or files.  Talks about certificates.
    I also looked at the SSF_BASE64_ENCRYPT/DECRYPT function modules on my system, which is ECC 6.0.  Wasn't sure if they could be used on a stand-alone basis, plus I couldn't find any documentation about them.
    I only want to encrypt, and then decrypt, the values in a 4 character field.   
        eg- DATA: MYFIELD(4) TYPE C.
    Is there an ABAP function module, or coding example, that would demonstrate this?
    Or possibly I overlooked something in the information that I have already found?
    Thank you,
    Dean Atteberry.

    Hi Morten,
    I would recommend reading the comments to the blog as well, as there would not be much difference between a 4 char field and...
    *-- check string-to-string algorithms
      string_in = 'Au weia, der Hahn legt keine Eier'. "#EC NOTEXT
      string_out = test_object->encrypt_string2string( string_in ).
      string_expected = 'AQYRHTFUERodER9UABMRGFQaHBU8VAYREFRYFR0RA1QBNQ=='.
      if string_out <> string_expected.
        result = abap_false.
        return.
      endif.
    ...if the result can be expected (in any SAP system) or easily reversed.
    But it might fullfill a requirement for obfuscation, which is what I was asking as well.
    Cheers,
    Julius

  • Validations(TCode GGB0)  are client dependent how to move from one client t

    Hi All,
    I have done chabges in Validation set (Requirement from FICO Functional). As Validations are client dependent. I done the changes in 200 client now Functional want me to do these in 100 client. So Will SCC1 TCode will wrok in this case ? Or there is any other method to transport from one client to other.
    Thanks..

    Dear friend .
            SCC1 works finely in this case. You have To create request and move it to development And for production transport this request..
    regards
    Ajit

  • How do I protect my FLV files? or How to encrypt and decrypt FLV files using AIR?

    Hi,
         I am working on an AIR application, which is developed on eLearning concept. The application mainly deals with flv files. The application contains a video player component, which will stream flv files from an Apache Server and played in my application. Here my concern is I would like to protect my flv files some how against users who may stream them from Apache Server and use them without my application.
         I thought of with an idea to do it. But I don't know whether it will work or not. So I am requesting for your suggestions and better ways to do this with a sample.
    Here is my thought:
    I would like to place the encrypted FLV files at Apache Server side [ Need to know how to encrpt the FLV files using Flex]
    As my AIR application send a request for a FLV file, the Apache server should send the decryption key and a stream of FLV file.
    AIR application should take the decryption key, stream of flv file and it should capable enough to decrypt the FLV file and play it in my application. [ But I don't know how to encrypt/decrypt FLV files through flex]
    I can do encryption of FLV files using Mac Address of Apache Server system and using Java. But I don't know how can I decrypt the same FLV file ( Encrypted using Mac Address and java ) at AIR application side.
    So I would be greatfull If any body help me in encrypting and decrypting of FLV file with a sample using Flex 3.0.
    Thanks
    Sudheer Puppala

    russellfromblackburn south wrote:
    Is it because the portable drive is NTFS format and the Mac wont recognise this? If so what do I do?
    Yes, this is exactly what is causing the problem. Macs cannot write to NTFS formatted drives, only read. You must move the documents to the internal HDD/SSD of the Mac to be able to edit them.
    Or, since you say you don't want to move the documents to the internal storage, you'll need to format the external HDD as FAT32.

  • How to encrypt user credentials when he logs on the Enterprise Portal

    Hi all,
    I want to use a cookie approach on SAP Enterprise Portal i.e. when the user first logs on, i would create a cookie and store the encrypted password in it so that next time he hits the portal, he is directly authenticated with the help of the cookie.
    For this above functionality, i need to know how the encryption & decryption techniques can be achieved by using the SAP Encryption libraries.
    Would be highly appreciative if i get some info on this.
    Thanx & regards,
    Jitendra Chaudhari
    India

    You can use logon ticket for the implementation you want to do. For security issues you are talking about then you can use the SSL connection for the client who is accessing the SAP Enterprise portal. For SAP Logon Ticket see the login modules CreateTicketLoginModule and EvaluateTicketLoginModule
    Initially set the ume.configuration.active = true
    For the security related issues ypu can set the following properties in the login modules
    1) ume.logon.security.enforce_secure_cookie to TRUE.
    Marks the SAP logon ticket as a secure cookie, to enforce that the client browser sends the cookie only when an SSL connection to the J2EE Engine or the reverse proxy is established.
    2) ume.logon.httponlycookie to TRUE
    If true, the SAP logon ticket is set to HttpOnly. This prevents it from being read by malicious client-side script code such as JavaScript. The setting is only effective for clients that use Microsoft Internet Explorer 6.0 SP1 or higher.
    I would suggest to use the 1st option as SAP also recommend the use of SSL connection for Logon Tickets.
    I wish this could help you a bit.
    Thanks and with regards
    Pravesh

  • How To Encrypt /Large The Large Files(eg:40MB)...

    Hi Everybody,
    How To Encrypt/Decrypt the (Size More Than 40 MB)files using sun jce/cryptix jce ?
    I have tried upto 22 mb file.But I had OutOfMemoryException.
    How To Avoid it?
    Plz help.
    Thankz
    vengins,Chennai.India

    Hi
    Actually, this has nothing to do with memory parameters. It is an issue of programming technique. Just don't slurp in the file all at once!
    Instead copy it step by step, buffer by buffer. Read it in e.g. 64KB chunks, encrypt the 64KB and write the encrypted buffer out until the file has been completely processed. There was already a discussion on this subject. Just search for it.
    Frank

  • How to build a tuxedo client execute file with C++Builder?

    Hi,all.
    I can add include file with #include.Add include path and lib path to project option.Add
    libengine.lib,libfml.lib,libfml32.lib,libtux.lib to project file.I can build the
    project without error.And communicate with the local tuxedo server successfully.But
    I've failed to communicate with a remote tuxedo server.For I know that use buildclient
    -w to build a C windows client file.How to build a GUI client project with C++builder?
    Thanks.
    david

    David,
    For a /WS client, you need a different set of libraries than those you have listed.
    To see which, run buildclient -w -v
    Regards,
    Peter.
    david wrote:
    Hi,all.
    I can add include file with #include.Add include path and lib path to project option.Add
    libengine.lib,libfml.lib,libfml32.lib,libtux.lib to project file.I can build the
    project without error.And communicate with the local tuxedo server successfully.But
    I've failed to communicate with a remote tuxedo server.For I know that use buildclient
    -w to build a C windows client file.How to build a GUI client project with C++builder?
    Thanks.
    david

  • How to keep track of client in rmi server

    how can I keep track of a disconnected client in a rmi server ?
    And what logic do I use to disconnect a client fro mthe server ?

    When a RMI client receives a stub to the remote object, RMI client runtime sends a dirty() call to the RMI server runtime which in turn helps the RMI server runtime in updating the client references to the remote object. Client reference is nothing but a unique identification generated by client RMI runtime for that instance of JVM. RMI uses a reference counting algorithm for destroying unreferenced remote objects. Once all references (all clients who are holding the stub to this remote object) to a remote object drops to zero, local garbage collector takes care of freeing this remote object.
    RMI client runtime initiates a TCP connection with the remote object only when a method is invoked on the stub. RMI transport layer uses a simple connection pooling mechanism to use already established TCP connections with server objects in further remote method invocations. Let's say the client is invoking a remote method on the remote object's stub fetched from the registry service. Now RMI transport layer initiates a TCP connection with the remote object (exported at ("host1", 4567)). After completion of the remote method, RMI client's transport layer keeps the connection open for some time (some configurable value) to take the advantage of the already established TCP connection in future remote method invocations on remote objects exported on the same host and port ("Host1", 4567"). RMI transport layer also takes care of closing these connections if the connections are idle more than configured value of connection open time.
    From the RMI server's perspective, once the RMI server runtime receives a remote method invocation request from the RMI client, it creates a new thread and try to dispatch the method on the designated remote object. After returning the results of the remote method to the client, RMI client's transport layer may not end this conservation with this remote object to take the advantage of this TCP connection in future remote method invocations. So the same thread may be used for dispatching another remote method in future. This is actually the side effect of re-using the established TCP connections on the client side.
    RMI server maintains client's reference in the client's reference set of the remote object as long as the client holds a normal reference to remote object's stub in its JVM. Once the client relinquishes the reference to the stub (goes out of the scope or setting it to the null), RMI client automatically sends clean() call to the RMI server runtime to update client reference set of the remote object. There is no public API to lookup or manipulate the client references for a given remote object, but you can always unexport the remote object even some clients are holding stubs to the remote object. Next time when the client invokes the remote method using this stub, client will receive a "connection refused exception" from the server because the remote object is already unexported. Let's say if the RMI server is started again (remote object is exported and registered with registry service), the client once again obtains the stub to the remote object from the registry service instead of using earlier stale stub. (This time remote object may have been exported on different port, so the port details in the old stub may not be valid any more).
    At any point of time there can be more than one established TCP connection with the RMI client. This may be the temporary condition; RMI client's transport layer automatically closes these connections if it does not receive any remote method invocation requests with in a pre-determined interval of time (default: 2 min). You can always find out RMI client's host in a given remote invocation by using getClientHost(), but how can you semantically define a "disconnected client in a rmi server" in your application context ? You can always force all the clients to fetch the stub again in future remote method invocations by unexporting the remote object in RMI server. I hope this information helps ...
    -- Srinath Mandalapu

Maybe you are looking for

  • Can't change email address in 4.0 Contact book

    I need to change my email address in the Sharing palette of the Contact book (as accessed from the Photo Browser).  When I highlight my address in the recipient list and then go to Edit, I get a message saying "This contact is used by a print recipie

  • Data Type of a Infoobject

    Hi Experts I am getting values from source system in the format of 22,22.3,30.5,1.3,99.99 As per my requirment i need to have a Selection variable in my report so that user can choose Show me all records which are > 30 and <35.5 So to meet my requirm

  • Purchase Order Form

    Hi, I am getting the following error while printing the form. I have written form routine ENTRY_NEU1  in the program ZVS_PURCHASE_ORDER_FORM. But still the error is coming. Processing routine ENTRY_NEU1 in program ZVS_PURCHASE_ORDER_FORM does not exi

  • Spatial Index Advisor : Error

    I get a couple of error messages in Spatial Index Advisor when trying to draw indexed geometries. The errors are: "Server object could not be created: server object could not be initialized: ORA-29902: error in executing ODCIIndexStart() routine", an

  • Still images become distorted

    When I add still images to a clip, they start out playing fine, but after maybe a minute or so they change to these distorted, weird lines...not even close to the original image. Can anyone give me any suggestions?