Javax.crypto.* and javax.crypto.spec.* problem with MHP receiver

Hello to everyone, I started to program in MHP 1.0.2 on a MHP receiver and now i'm practicing in encrypting and decrypting. I load from the smart card in the MHP receiver an X509Certificate object (I have it both in byte[] form, called certArray, and X509Certificate object, called "certificate"). What i'd like to do is to :
1)calculate digest of the certificate (line 1 and 2 of the following code)
2) encrypt the digest using the same algorithm of the certificate (see line 3 and 4)
The problem is generated at line 3 : the receiver, probably, doesn't find the class of the algorithm of encrypting. It is important to notice that the instruments to encrypt/decrypt are included in javax.crypto and javax.crypto.spec packages.
MessageDigest md = MessageDigest.getInstance("SHA");
byte[] digest = md.digest(certArray);
Cipher encrypt = Cipher.getInstance(certificate.getSigAlgName());
encrypt.init(Cipher.ENCRYPT_MODE, certificate.getPublicKey());
The error message, in the log file, is the following :
[0#1:2] java.security.NoSuchAlgorithmException: SHA1withRSA not found
     [0#1:2]      at javax.crypto.Cipher.getInstance(Ljava/lang/String;)Ljavax/crypto/Cipher;(Unknown Source)
     [0#1:2]      at it.csp.SecurelabXlet.encrypt()V(Unknown Source)
     [0#1:2]      at it.csp.SecurelabXlet.cardInserted(Lopencard/core/event/CardTerminalEvent;)V(Unknown Source)
     [0#1:2]      at opencard.core.event.EventGenerator.createEventsForPresentCards(Lopencard/core/event/CTListener;)V(Unknown Source)
     [0#1:2]      at it.csp.SecurelabXlet.register()V(Unknown Source)
     [0#1:2]      at it.csp.SecurelabXlet.startXlet()V(Unknown Source)
     [0#1:2]      at java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;(Unknown Source)
     [0#1:2]      at tv.osmosys.application.AppManager$XletApp.xletStart()Z(Unknown Source)
     [0#1:2]      at tv.osmosys.application.AppManager$XletApp.loop0(Ltv/osmosys/application/AppManager$XletAction;)V(Unknown Source)
     [0#1:2]      at tv.osmosys.application.AppManager$XletApp.run()V(Unknown Source)
     [0#1:2]      at java.lang.Thread.run()V(Unknown Source)
     [0#1:2]      at java.lang.Thread.startup(Z)V(Unknown Source)
My question(s) is : how can I include javax.crypto and javax.crypto.spec in the Xlet application to upload it onto the MHP receiver?? Is it possibile to do so?
Eventually, do other libraries exist to use encrypting algorithms, included in MHP? The version I use of MHP is 1.0.2. Thank you! Bye!

Hello to everyone, I started to program in MHP 1.0.2 on a MHP receiver and now i'm practicing in encrypting and decrypting. I load from the smart card in the MHP receiver an X509Certificate object (I have it both in byte[] form, called certArray, and X509Certificate object, called "certificate"). What i'd like to do is to :
1)calculate digest of the certificate (line 1 and 2 of the following code)
2) encrypt the digest using the same algorithm of the certificate (see line 3 and 4)
The problem is generated at line 3 : the receiver, probably, doesn't find the class of the algorithm of encrypting. It is important to notice that the instruments to encrypt/decrypt are included in javax.crypto and javax.crypto.spec packages.
MessageDigest md = MessageDigest.getInstance("SHA");
byte[] digest = md.digest(certArray);
Cipher encrypt = Cipher.getInstance(certificate.getSigAlgName());
encrypt.init(Cipher.ENCRYPT_MODE, certificate.getPublicKey());
The error message, in the log file, is the following :
[0#1:2] java.security.NoSuchAlgorithmException: SHA1withRSA not found
     [0#1:2]      at javax.crypto.Cipher.getInstance(Ljava/lang/String;)Ljavax/crypto/Cipher;(Unknown Source)
     [0#1:2]      at it.csp.SecurelabXlet.encrypt()V(Unknown Source)
     [0#1:2]      at it.csp.SecurelabXlet.cardInserted(Lopencard/core/event/CardTerminalEvent;)V(Unknown Source)
     [0#1:2]      at opencard.core.event.EventGenerator.createEventsForPresentCards(Lopencard/core/event/CTListener;)V(Unknown Source)
     [0#1:2]      at it.csp.SecurelabXlet.register()V(Unknown Source)
     [0#1:2]      at it.csp.SecurelabXlet.startXlet()V(Unknown Source)
     [0#1:2]      at java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;(Unknown Source)
     [0#1:2]      at tv.osmosys.application.AppManager$XletApp.xletStart()Z(Unknown Source)
     [0#1:2]      at tv.osmosys.application.AppManager$XletApp.loop0(Ltv/osmosys/application/AppManager$XletAction;)V(Unknown Source)
     [0#1:2]      at tv.osmosys.application.AppManager$XletApp.run()V(Unknown Source)
     [0#1:2]      at java.lang.Thread.run()V(Unknown Source)
     [0#1:2]      at java.lang.Thread.startup(Z)V(Unknown Source)
My question(s) is : how can I include javax.crypto and javax.crypto.spec in the Xlet application to upload it onto the MHP receiver?? Is it possibile to do so?
Eventually, do other libraries exist to use encrypting algorithms, included in MHP? The version I use of MHP is 1.0.2. Thank you! Bye!

Similar Messages

  • Problems Compiling javax.servlet and javax.servlet.http

    When I try to compile a program that imports both javax.servlet and javax.servlet.http, the compiler keeps telling me that "package javax.servlet does not exist"... I have place the javax.servlet packages in the src.zip and in the src folder but i dont understand why the compiler isnt picking them up. Maybe I did something wrong ... could someone help please

    Try to compile vith the option "-classpath /your/path/to/servlet.jar"

  • I have an iPhone 4S and never had a problem with syncing it. But suddenly, when I connected my phone to my mac, it says that its in recovery mode, and I need to restore it in order to sync. I've updated both my phone and my itunes, and it didnt work.Help?

    I have an iPhone 4S and never had a problem with syncing it. But suddenly, when I connected my phone to my mac, it says that its in recovery mode, and I need to restore it in order to sync. I've updated both my phone and my itunes, and it didnt work.Help?

    fighter19lisa wrote:
    that only makes it say its synced, when its not.
    No, it does not.  It transfers purchases from the iDevice to the computer.  The computer must be authorized for the Apple ID that the content was acquired with.
    fighter19lisa wrote:
    my playlists wont show up on the phone.
    Are they selected to sync?  Is Manually Manage content on the device selected?
    fighter19lisa wrote:
    i had to change my password for my aol account again and i still cannot get my email on my phone to even work
    What does that have to do with syncing content to the device?  FYI, nothing.

  • HT201304 Hi! My My mom bought me an iPhone 5 and I have a problem with my facetime I cant find it! Cant find it in settings and restrictions. She bought this in Bahrain both my iPhone and she ipad mini and she has facetime on her. What should I do?

    Hi! My My mom bought me an iPhone 5 and I have a problem with my facetime. I cant find it! Cant find it in settings and restrictions. I remember when she gave me this I see facetime in settings and after a couple of days its gone! She bought this in Bahrain both my iPhone and her iPad Mini. And I'm just wondering why she has facetime and why mine is missing? Please help! My iMessage is perfectly working. I lived in the Philippines

    Are you trying to use the phone in Bahrain with a supported carrier there? I suspect not. If you try to use this phone outside of Bahrain, you won't have FaceTime. This is done to prevent folks from simply crossing the border to purchase iPhones in Bahrain...FaceTime is banned in Saudi Arabia & the UAE. Sorry, but you'll only have FaceTime on that phone while using it in Bahrain on a supported carrier's network there.

  • I can't send emails from Mail. I have three different accounts set up and have the same problem with all. The mail just sits in my outbox. All worked fine until Yosemite upgrade. Recent update has not fixed problem.

    I can't send emails from Mail. I have three different accounts set up and have the same problem with all. The mail just sits in my outbox. All worked fine until Yosemite upgrade. Recent update has not fixed problem.

    I have been experiencing the same problem. My mail app won't even open on my Late 2011 Macbook Pro. It will show as open, but the app will never actually show up.

  • I had already update mi new factory unlocked iPhone 4S to iOS 5.1.1 and I still having problems with "invalid sim". I'm from Argentina and here we don't have official service. PLEASE HELP ME, WHAT CAN I DO??? In Argentina is too expensive an iPhone 4S.

    I had already update mi new factory unlocked iPhone 4S to iOS 5.1.1 and I still having problems with "invalid sim". I'm from Argentina and here we don't have official service. PLEASE HELP ME, WHAT CAN I DO??? In Argentina is too expensive an iPhone 4S. Please I need help to continue believing in Apple. Thanks a lot. If anybody speak spanish better.  

    Was it purchased from an official Apple Store, not a reseller?  Only Apple Stores sell official factory unlocked phones.  The others sell hacked to unlock phones, and the unlocking is unstable.
    Try these steps, as needed:
    1. Reset phone - press both home and on/off buttons for at least 10 seconds until the Apple logo appears.
    2. Settings > General > Reset > Reset Network Settings.
    3. Replace SIM card (and reset network settings again)
    4. Restore Phone in iTunes using a backup
    5. Restore in iTunes as new, without using a backup

  • Since the most recent Firefox update 3.6.8 by banking institution no longer shows as having a secure encrypted connection, however, my bank assures me all is well with their certificates and that is a problem with the new Firefox browser update, can you g

    Since the most recent Firefox update 3.6.8 my banking institution no longer shows as having a secure encrypted connection, however, my bank assures me all is well with their certificates and that is a problem with the new Firefox browser update, can you give me some idea why it is doing this?
    == This happened ==
    Every time Firefox opened
    == Right after the new Firefox update

    Hello Anne.
    Can you please try it in a new (temporary) Firefox profile and see if the issue is still present? See [http://support.mozilla.com/en-US/kb/Managing+profiles this article] to know how to create a new Firefox profile. Please report back the results.

  • Trying to access hotmail account but it is taking forever to get into hotmail it was working ok at start of week only yesterday and today have a problem with it

    rying to access hotmail account but it is taking forever to get into hotmail it was working ok at start of week only yesterday and today have a problem with it

    You can try these steps in case of issues with web pages:
    You can reload web page(s) and bypass the cache to refresh possibly outdated or corrupted files.
    *Hold down the Shift key and left-click the Reload button
    *Press "Ctrl + F5" or press "Ctrl + Shift + R" (Windows,Linux)
    *Press "Command + Shift + R" (Mac)
    Clear the cache and remove cookies only from websites that cause problems.
    "Clear the Cache":
    *Firefox/Tools > Options > Advanced > Network > Cached Web Content: "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Firefox/Tools > Options > Privacy > "Use custom settings for history" > Cookies: "Show Cookies"
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem.
    *Switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance
    *Do NOT click the Reset button on the Safe Mode start window
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • I installed Mavericks yesterday and have now got problems with QuarkXpress 9. Every time I click on an image and try to move it the application crashes. Anyone had similar problems or got any suggestions?

    I installed Mavericks yesterday and have now got problems with QuarkXpress 9. Every time I click on an image and try to move it the application crashes. Anyone had similar problems or got any suggestions?

    Hi Guys
    Updated my 2 imacs to Maverick yesterday. Schoolboy error on my part not checking if there were problems with any programmes before I did.
    Quark is now a nightmare with no short term answer on the way. As a Quark user for over 20 years this is just another reason to hold your hands up and say OK Indesign you win I will have to learn how to use you and Quark will be a distant memory.
    I am told there will probably be no solution to getting quak 9 running on Maverick and that you will need to update to 10 in about 2-3 weeks to get back to normal. Having spent a few bob on 2 versions of 9.5 only in Feb this year i didn't really want to upgrade yet.
    So its cough up to carry on using Quark or learn Indesign.
    I have lost faith in Quark as they are quick to send me e-mails asking me to upgrade to this and that version, why didn't they send one out saying do not upgrade to Maverick. Perhaps they know there loyal follwing will uograde to 10 and will generate a nice little bonus before Xmas.
    Lots to do today and will now take 10 times longer to do it. Is this 2013 or 1974!!!!!
    If anyone hears of a solution please post ASAP

  • We have a mac laptop and dont have any problems with pdf files but our imac will not open them.  any suggestions

    we have a mac laptop and dont have any problems with pdf files but our imac will not open them.  any suggestions?

    Back up all data.
    In the Finder, select Go ▹ Go to Folder from the menu bar, or press the key combination shift-command-G. Copy the line of text below into the box that opens, and press return:
    /Library/Internet Plug-ins
    From the folder that opens, remove any items that have the letters “PDF” in the name. You may be prompted for your login password. Then quit and relaunch Safari, and test.
    If you still have the issue, repeat with this line:
    ~/Library/Internet Plug-ins
    If you don’t like the results of this procedure, restore the items from the backup you made before you started. Relaunch Safari again.

  • I just bought an AirPort Extreme system over this weekend and I am having problem with setting it up. I plugged the cable as explained in the manual but there is no way I can get a steady green light. I all see is flashing amber light. Can anyone help me,

    I just bought an AirPort Extreme system over this weekend and I am having problem with setting it up. I plugged the cable as explained in the manual but there is no way I can get a steady green light. I all see is flashing amber light. Can anyone help me,

    Think you need to provide some more details about what you are connecting

  • I recently upgraded our iMac to Yosemite OS and now have a problem with Photoshop Elements 11:  the move tool selects an image or text layer, but then I try to drag the selection somewhere else on the page and it snaps back to the original location, howev

    I recently upgraded our iMac to Yosemite OS and now have a problem with Photoshop Elements 11:  the move tool selects an image or text layer, but then I try to drag the selection somewhere else on the page and it snaps back to the original location, however the arrows will move it OK.  Also I cannot drag the selection to another photo in the photo bin as before.

    Hi,
    Please refer: http://helpx.adobe.com/photoshop-elements/kb/pse-stops-responding-yosemite.html
    Thanks,
    Anwesha

  • HI, I just bought Photoshop CS5 and I have a problem with HDR pro

    HI, I just bought Photoshop CS5 and I have a problem with HDR pro . when I am trying to mount 3 images together it act in a strange way ( the images appear and disappear many times) then when the window with the result appear and I say ok it open up in photoshop as a single image ( in the layers there is just 1 photo) and when I am trying to work it up with the Plug in/filter HDR Effex Pro (Nik softwear) a pop up window appear saying that the file is missing and the operation it is not possible. Why and what is happening ? Someone can help me ?

    This is normal operation. The output from HDR pro does not produce a layered file. You make all your adjustments in the Nik Plug-in. Once Nik has finished you then make any rinal changes in Photoshop. Trying to use NIK again on the image in Photoshop is not the way to do this.
    When HDR pro comes up do you see all the presets and controls? Presets on the left and controls on the right
    MK

  • I have a iPhone 4S 16 gb and I am having problem with sim activation please tell me what to do

    I have a iPhone 4S and I am having problem with its.activation plz tell me. The solution of this problem?

    Did you already try these steps?
    Restart the iPhone.
    Try another means of reaching the activation server and attempt to activate.
    Try connecting to a known-good Wi-Fi network if you're unable to activate using a cellular data connection.
    Try connecting to iTunes if you're unable to activate using Wi-Fi.
    Restore the iPhone.
    If you receive an alert message when you attempt to activate your iPhone, try to place the iPhone in recovery mode and perform a restore. If you're still unable to complete the setup assistant due to an activation error, contact Apple for assistance.
    copied from iOS: Troubleshooting activation issues

  • I Just upgraded to mountain lion os x to 10.8.1 and I have a problem with restart my computer

    I Just upgraded to mountain lion os x to 10.8.1 and I have a problem with restart my computer.
    Now my computer is stuk on restart and wont turn on.
    Can somone help me with it?
    Thanks.

    If Mende 1's suggestion doesn't solve it you might find the following useful:
    I would first reset the SMC:
    Shut down and unplug the Mac.
    Keep the Mac unplugged for at least fifteen seconds.
    Plug the Mac back in and do not turn it back on for at least five seconds.
    Press the power button to turn the Mac back on.
    Then I would reset the PRAM by rebooting the iMac while simultaneously holding the Command-Option-P-R keys until the machine restarts a second time.
    Hope this helps

Maybe you are looking for