RSA key problem

I'm working on a project of authentication and I have a weird bug. (This is my first project on JavaCards).

The problem is that I am not a different length of 512-bit RSA key. I load the application on emulated map. Here is the code

try {}
KeyM = new KeyManager ((short) 1024);
} catch (Exception e) {}



Public RSAKey(short size) throws Exception {}

bufferA = new ubyte [size];
bufferB = new ubyte [size];

paireDeClef = new KeyPair (KeyPair.ALG_RSA, KeyBuilder.LENGTH_RSA_1024);




paireDeClef.genKeyPair ();
publicKey = (RSAPublicKey) paireDeClef.getPublic ();
privateKey = (RSAPrivateKey) paireDeClef.getPrivate ();

CIP = Cipher.getInstance (Cipher.ALG_RSA_PKCS1, false);
}

I already tried to throw a CryptoException... He didn't show me any error message.
Am I using try catch correctly?


All my thanks!

No, you're not. You catch the exception and even printing. If you have no idea why it does not work.

Never do this.

Print the stack trace and post it here if it's not always you enlighten.

Tags: Java

Similar Questions

  • getvpn key problem

    I get this newspaper.

    GDOI-1-KS_NO_RSA_KEYS %: RSA - GROUP_KEY key: not found, required for the Group GROUP_1

    Even if I create rsa keys, I always get this journal...

    KEY-2 #sh crypto mypubkey rsa key

    % Of key pair is generated at: 16:14:02 UTC on July 26, 2011

    Key name: KEY-2. GETVPN.com

    Storage device: private-config

    Use: Encryption key

    The key is exportable.

    Key data:

    305C300D 06092 HAS 86 01010105 00034B 00 30480241 00AF6DD5 94776919 4886F70D

    24753 C 02 6AC2937B 73600F1C FD958857 16A5564E CF66D1F8 26BCFC60 1 B 986527

    37611A 72 A699EEF3 2C6CE411 EE809A20 D86E0BFF C4753A43 E1020301 0001

    % Of key pair is generated at: 16:20 UTC, July 26, 2011

    Key name: KEY - 2.GETVPN.com.server

    Temporary key

    Use: Encryption key

    Key is not exportable.

    Key data:

    307C300D 06092 HAS 86 4886F70D 00036B 00 01010105 00ACB3B4 30680261 61488B 26

    1B094A8D 3D9E30FC 4F204DB8 00842618 B16BA72A A0004264 8EAFAE2A 9A6851D5

    A60F8C12 83E47F2E F59E1479 1BA75C5A 8CBC4BFA CD303587 E788B2D0 1CFE0CD6

    A3466D75 FCCFE4F7 9F1AFB4C F0B3ADD9 58BCB2AA 64149AC5 0B 020301 0001

    What should be the problem?

    config:

    crypto ISAKMP policy 1

    BA aes 256

    preshared authentication

    Group 2

    life 3600

    ISAKMP crypto key GETVPNKEY address 5.5.5.5

    ISAKMP crypto key GETVPNKEY address 6.6.6.0 255.255.255.0

    ISAKMP crypto key GETVPNKEY 1.1.1.0 address 255.255.255.0

    ISAKMP crypto key GETVPNKEY address 123.0.0.0 255.0.0.0

    ISAKMP crypto keepalive 10

    !

    !

    Crypto ipsec transform-set esp-3des esp-sha-hmac GETVPN_TRANS_GROUP

    !

    Profile of crypto ipsec GDOI_PROFILE_GROUP

    Set security-association second life 7200

    game of transformation-GETVPN_TRANS_GROUP

    !

    gdoi crypto group GROUP_1

    Identification number 1

    local server

    generate a new key broadcast 10 number 2

    generate a new GROUP_KEY mypubkey rsa authentication key

    generate a new key transport unicast

    its ipsec 1

    Profile GDOI_PROFILE_GROUP

    match address ipv4 GETVPN_ACL

    no replay

    ipv4 123.1.1.3 address

    redundancy

    Local priority 10

    peer of ipv4 123.1.1.2 address

    GETVPN_ACL extended IP access list

    Licensing ip 1.1.1.1 host 5.5.5.5

    Licensing ip 1.1.1.1 host 6.6.6.6

    permit ip host 6.6.6.6 1.1.1.1

    permit ip host 5.5.5.5 1.1.1.1

    !

    access list 101 ip allow a whole

    Hello

    The name of the rsa key configured in the gdoi group is GROUP_KEY. Keys with this name doesn't seem to be present on the device. The present only key in sh crypto mypubkey rsa key is KEY-2. GETVPN.com.

    Try changing the command "generate a new passkey mypubkey rsa GROUP_KEY" to "generate a new key mypubkey rsa authentication".

    KEY-2. GETVPN.com ".

    Or generate another set of key with the name GROUP_KEY

    -Atul

  • RSA key generation fails on JCARD 2.2.2

    Hello

    I am a beginner in JCard programming (2 days of experience...) and I'm trying to deploy an application on an emulated map ARB who generates an RSA key pair and sends the public key via the client application of RMI, home somehow, when I run the init method of the client application, I get this exception:

    Exception in thread "main" java.lang.UnsatisfiedLinkError: com.sun.javacard.impl.NativeMethods.getCurrentContext (B)

    at com.sun.javacard.impl.NativeMethods.getCurrentContext (Native Method)

    at com.sun.javacard.impl.PrivAccess.getCurrentAppID(PrivAccess.java:454)

    to javacard.framework.CardRuntimeException. < init > (CardRuntimeException.java:46)

    to javacard.security.CryptoException. < init >(DashoA10*..: 25).

    at com.sun.javacard.javax.smartcard.rmiclient.CardObjectFactory.throwIt (unknown Source)

    at com.sun.javacard.javax.smartcard.rmiclient.CardObjectFactory.throwException (unknown Source)

    at com.sun.javacard.javax.smartcard.rmiclient.CardObjectFactory.getObject (unknown Source)

    at com.sun.javacard.rmiclientlib.JCRemoteRefImpl.parseAPDU (unknown Source)

    at com.sun.javacard.rmiclientlib.JCRemoteRefImpl.invoke (unknown Source)

    at sid2.CompteurImpl_Stub.initialiser (unknown Source)

    to sid2. ClientRmi.main (ClientRmi.java:36)

    and here is the code of my called JCard cmdlet:

    sid2 package;

    import java.rmi.RemoteException;

    Import javacard.framework.UserException;

    Import javacard.framework.service.CardRemoteObject;

    Javacard.security import. *;

    Import javacardx.crypto.Cipher;

    public class compteurimpl extends CardRemoteObject implements {ICompteur}

    private bytes counter = 120;

    RSAPrivateKey rsa_PrivateKey;

    RSAPublicKey rsa_PublicKey;

    Rsa_KeyPair key pair;

    Encryption by cipherRSA;

    {public setPub Sub (byte [], byte [] mod expo)

    rsa_PublicKey.setExponent (expo, (short) 0, (short) expo.length);

    rsa_PublicKey.setModulus (mod, (short) 0, (short) mod.length);

    }

    public byte [] getPub() {}

    Byte [] ret = null;

    rsa_PublicKey.getModulus (ret, (short) 0);

    rsa_PublicKey.getExponent (retirement, short ()(ret.length+1));

    return ret;

    }

    Public Sub initialiser(byte v) throws RemoteException, {UserException}

    rsa_KeyPair = new pair of keys (KeyPair.ALG_RSA, KeyBuilder.LENGTH_RSA_2048);

    rsa_KeyPair.genKeyPair ();

    rsa_PublicKey = rsa_KeyPair.getPublic () (RSAPublicKey);

    rsa_PrivateKey = rsa_KeyPair.getPrivate () (RSAPrivateKey);

    counter = v;

    }

    }

    anyone can point out what I'm doing wrong here? Thank you

    PS: I already tried some basic stuff and it works beautifully, as having a variable on a Jcard and incrementing, get and put.

    Hello

    You can view the documentation, but memory emulator CREF only supports 512-bit keys.

    The code below has also the question that you want to copy to a buffer zero. You must allocate a buffer, or use a buffer allocated previously as the APDU buffer. This method allocates memory for you.

    public byte [] getPub() {}

    Byte [] ret = null;

    rsa_PublicKey.getModulus (ret, (short) 0);

    rsa_PublicKey.getExponent (retirement, short ()(ret.length+1));

    return ret;

    }

    -Shane

  • Re: Satellite A660-1EK - FN keys problem

    Hello
    I don't know how I did that... but yesterday my mobile function buttons worked, but now I press fn + f6 or fn + f6, it must change in light of the screen, but there is nothing.
    There is not a problem with the fn key because when I press keys fn + 3 or by changing its fn + 4.

    How can I solve my problem?

    Since when is FN + F4 or FN + 3 for the sound?
    As far as I know it's for the standby and hibernation.

    Try also first roll back OS to an earlier time using System Restore tool. Make back two or three days.

  • Satellite Pro A300 he can't start WLan - Fn + F8 key problem

    Hello

    I have a wireless satellite pro a300-1nt model problem... I have instaled win7 ultimate (32 bit) and and all the Nice work, except that... in the household of wireless device is all ok, windows recognizes the card, he said all work perfectly... but when I try to start it, nothing happens. When I try to solve the problems they say "WiFi is disabled" and something like "Use the power switch on the front of the computer, or the function keys, if necessary activate wireless", but when I use Fn + f8 nothing happens...

    Now I don't know what the problem... don't know what to do... windows recognizes the card, but I can't start with buttons: (...) I have try all the drivers that I can find but nothing, if someone have similar problem or know something useful, please share... :(

    Thank you
    Aleksandar

    PS Sorry for the bad English

    Hello

    You have installed Win 7 but you didn t install some tools that controls the FN keys!

    You need to install the support card Flash Utility and added value package!
    You can find that both page European driver Toshiba Satellite L500 download area!

    PS: I think you should also check the BIOS settings. Some BIOS contains an option to toggle the wifi.

    In addition, go to-> properties Device Manager card Wlan-> Advanced tab
    Here, you can activate Wlan card too!

  • Satellite 5200: Function key problem

    Hello

    Recently the function keys have stopped working on my satellite 5200. When I now hold the function key and attempt to use one light you, sounds, etc., buttons, nothing happens.

    Any idea settings or what I've done, I need to check.

    Thank you.

    Paul.

    Hello

    I also had similar problems with a Sat5200 from a friend.

    We have a United Nations - and reinstalled the common Modules Toshiba, Toshiba Hotkey utility and Toshiba controls.

    then it worked again!

    Rudi Bye

  • USB keys - problem with the Recovery Manager

    I bought a 16GB Kingston DataTraveler 112 USB key so I could copy the recovery as a backup image. He acknowledged the USB key and showed that the recovery image has been slightly more than 11 GB. But when he started to format the USB key, it returns to the previous screen and asking more of the car. At the bottom of the screen, he said to contact the HP Support, but it gives me an error message. Now when I try the Recovery Manager it does not recognize the USB at all.

    Before that, I had bought another 16 GB USB - don't remember what brand. I have 5 other USB drives, but they are all small, except a 32 GB Kingston DT101 G2 which does not work on this computer, even if it worked on my old computer (Pavilion w/Vista Home Premium) without problem. All these USBs, including the new Kingston are for USB 2.0.

    Operating system is Windows 8.1 64-bit on the desktop HP Pavilion 500 - A60. I tried the problem that USB keys in all 4 ports (2.0 and 3.0). Also in that I plug into a port to give me 3 USB ports, also used on my previous computer.

    Is it possible that this computer does not recognize Kingston or some other brands of USB thumb drives?

    The trick to this is to use a USB 2.0 port and use a non-windows 8 certified thumbdrive. If the USB flash drive shows as a 'removable device' there should be no problem in the use of the media to create a recovery media

    I had a lot of success with a 16 GB Transcend USB 3.0 flash drive.

    I own a couple of DataTraveler flash drives and had the same lack of success, creation of recovery media that you did. I have had zero success with 3.0 of Sandisk Extreme usb flash drives

  • Flashcards and Fn - Satellite A200 psae6e key problem

    Hi all.

    I read a lot of posts with this problem.
    I noticed some people fix with value Canadian extra package, but is not a Canadian package extra for my model.
    I have a200-psae6e. But I download Canadian version, it is not for my model, I installed it but it does not work. Flashing cards do not appear.

    Then I installed the extra package for my model and it works fine, but does not work Fn + Fx! I have
    the value cards turn signals don't start up with Windows and now I can use Fn + Fx but only for keys ESC, F1, F3, F6, F7 and F11, other do not work!

    Can someone tell me how to force the other keys work?
    I didn't need flashing cards if I have good, that also I don't have turn signals with Fn + Fx cards keys don't work all the keys.

    Is there a solution?

    Same problem with my computer, but even worse because when I push button FN of my computer crashes. Nobody seems to know the solution. If you can, uninstall all versions of VAP, you have and try to reinstall one with advanced options, common Module is checked and pray. I think that some components of vista update is related to the normal working FN.

  • Satellite L750D - brightness FN key problem

    Hello

    Had a bit of a problem, trying to figure out why my screen was black, worked through HDMI and a second monitor ran without drama, but as soon as the diagnosis established, is to adjust the brightness of FN keys.

    When I put my brightness key FN adjust less than 6 years (5 or less) it will clear, black (black not total as long as the information is still there but almost impossible to see).

    I launch colormunki on that on the screen which is currently updated the color profile.

    Does anyone know if color monitors of profiling leads to problems of drama with the brightness of the screen FN?

    Or maybe it is something different all together.

    Hello

    It seems that the portable computer s display supports the LED backlight.
    Usually the FL inverter controls the backlight of the display.
    As far as I know than the Panel FL inverter and LCD are connected to the motherboard. The fluorescent lamp is connected to the FL inverter Board.

    In your case, it might be possible that the screen, fluorescent lamp or the FL inverter might not work.

    Don t think that the graphics card is affected from the external screen is OK.
    So in your case, I would recommend asking a single Toshiba ASP to check parts

    By the way: have you tried to update the BIOS or the display driver? I think it is worth a try before contact with service agents.

  • Arrow keys problem

    I have the problem with the arrow keys (up, right, down, left).

    When one of these keys is pressed, not quickly and at any time, the cursor continues the movement about a second after the button is released.

    So it is possible to adjust the slider to the position of certain precisely if there is carring out pressing short-term.

    Hello

    > When one of these keys is pressed quickly and at any time, the cursor continues the movement about a second after releasing the button

    I think I know why this is happening.
    In my view, pressing one of these keys cause an overload of the processor, and this could be caused by dysfunction of the keyboard.

    I think the laptop technician should replace the keyboard and must verify if this strange problem seems once again.

  • Satellite L500-1XU - FN keys problems

    Hello!

    Since I bought my laptop (Satellite L500-1XU), I have a problem with my keyboard I can't understand.
    It happens that without + Toshiba added economic package for Win7-32 bit + ([this version | http://www.csd.toshiba.com/cgi-bin/tais/support/jsp/download.jsp?ct=DL&soid=2485090&ref=EV]) some work of combinations of FN (such as the ESC, F1, F3, F5, F6, F7) but the rest of them do not work.

    So, I install PVAT and now none of them work. If I click on any flash card it makes his work, but the key to refuse commands to work.

    My guess is that the PVAT version I use is incompatible with my laptop model: http://img15.imageshack.us/img15/9746/satellitel500.jpg
    But I can't find the right version. So I ask for your help.

    If you have any ideas please press on answer.

    Thank you for advice!

    Sand0

    Hello

    Your laptop belongs to the series of Satellite L500 PSLJFE.
    Go to the page of European Toshiba driver and download the VAP and card utility for Satellite L500 PSLJFE flashing support.

    This should help!

    Otherwise you have some registry problems and in this case, you must clean the registry with CCleaner for example
    This free tool cleans the BONES once you should install VAP and Flash cards again.

    Welcome them

  • Code key problem

    Two copies of Vista Ultimate has acquired five years ago.  Each has its own key code which worked without problems.  Now I find that one of them now refers as "invalid" want to pursue this but do not know the proper channels to do so.

    Try to activate by phone.

    How to activate Windows 7 or Vista manually (activate by phone)
    http://support.Microsoft.com/kb/950929/en-us

    1) click Start and in the search for box type: slui.exe 4
    (2) press the ENTER"" key.
    (3) select your "country" in the list.
    (4) choose the option "activate phone".
    (5) stay on the phone * do not select/press any option * and wait for a person to help you.
    (6) explain your problem clearly to the support person.
    (7) the person must give you a confirmation ID, copy it down on paper,
    (8) check that the ID is correct in reading the support person.
    (9) to enter the ID number, then click 'Next' to complete the activation process.

    Activation and registration of a Microsoft product
    http://support.Microsoft.com/?kbid=326851
    Windows activation: (888) 571-2048
    (888) 725-1047 or 800-936-5700

    J W Stuart: http://www.pagestart.com

  • HP Pavilion dv6-3055tx keyboard key problem

    Dear Sir

    My laptop is HP Pavilion dv6-3055tx and win 7 ultimate 64 bit installed.

    Leave for a few days, I noticed that three keys on my keyboard don't work all the time that the wifi key is YOU.

    These keys are:

    1 remove

    Left arrow 2

    Right arrow 3

    When I disable the wifi key, it works normally.

    I don't know what really is the problem?

    Please help me with this problem.

    Thank you

    Hello

    Sugg_r_es following.

    Open windows control panel, open Device Manager, expand keyboards, right-click on the "Standard PS/2 Keyboard" entry and select uninstall.

    Shut down the laptop - if you're running Windows 8/8.1, do it by holding down the button SHIFT left click Shutdown to temporarily prevent a hybrid boot.

    Then disconnect the AC adapter and then remove the battery.  Press and hold the Power button for 30 seconds.  Reinsert the battery and plug in the AC adapter.

    Robinet tap away at the key esc that you start the computer to launch the Start Menu, and then select f10 to open the bios menu.  Press f9 to load the default values (sometimes it is f5, but the menu below indicates the correct key), use the arrow keys to select 'Yes' and press ENTER.  Press f10 to save the setting and still use the arrow keys to select 'Yes' and press on enter.

    Kind regards

    DP - K

  • 2 problems that occurred at the same time - shift key & problem mouse

    I copied and pasted an email address into a new email.  Now, whenever I press the SHIFT key, it copies the same thing several times in the format of electronic mail and WORD.

    In addition, my mouse now I cannot hold the left key to highlight words.  Nothing happens.

    any suggestions are greatly appreciated.

    Thank you

    Hello


    1. What is the number of brands and models of mouse and keyboard?
    2. were there any changes (hardware or software) to the computer before the show?

    Perform operations by the items listed below and see if the problem persists.
    http://support.Microsoft.com/kb/258826
    http://support.Microsoft.com/kb/303091
     
    Note: Proceed as if you are using a Microsoft Keyboard and mouse.

    Hope this information helps.
  • Expression Studio product key problem on re - install

    I lived all the help from microsoft and supported sites and forums (and several others) and there are questions similar but although I can work on them (all sources) what's going on I can't find an answer, and the only way I can get the support of Microsoft is to pay for it because of this problem , emailing them led it is suggessted I ask here so sorry if I am repeating something already asked but I really don't know what else to do.

    I bought Studio Expression a couple of years ago for my daughter (the memory blurred here but I am sure it's the version 1 but has been upgraded via download on 2 as a special microsoft encouragement - as they do now for 3-4).  It has been installed and works very well then the hard drive has not changed, re-installed and all worked fine again until a few weeks ago when problems of memory led to one perfect reformat and re-install. Studio expression re will not activate as it claims that my product key is not valid. I also can't support since it requires my product key and said "there is a problem" with him when I entered it.

    Expression Studio now seems running on the 60-day trial license, I need to find a way to overcome this problem without having to hand over my credit card data to microsoft for support.

    I had already decided to update its version (she uses it because his school do and they are still using version 2) but in no way can I do if the reason why I came to understand of what is correct.

    My pc is custom made and as such comes with no software installed and so I buy all my separately from the software, it is not the OEM versions.  I have Windows Vista 64-bit on the affected system and everything worked very well on that front.

    Hi lollylou,

    Because the question you posted is related to Microsoft Expression studio, it would be better suited in the Microsoft Expression forum. Please post your question in the following Microsoft Expression forum to improve assistance:

    http://social.expression.Microsoft.com/forums/en-us/categories

    Concerning

    Jeremy K
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

Maybe you are looking for