How to change RSAPublicKeySpec to Key for encrypt?

I have RSAPublicKeySpec and I want to encrypt message with this key.
How to change RSAPublicKeySpec to Key for encrypt message?

I try to do this
try {
kf = KeyFactory.getInstance("RSA");
pk = kf.generatePublic(pubCard);
catch (NoSuchAlgorithmException ex4) { System.out.println("1");
catch (InvalidKeySpecException ex4) { System.out.println("2");
try {
Cipher cipher = Cipher.getInstance("RSA");
try {
cipher.init(Cipher.ENCRYPT_MODE, pk);
catch (InvalidKeyException ex2) { System.out.println("a");
try {
ticket = cipher.doFinal(mes.getBytes());
catch (IllegalStateException ex3) {System.out.println("b");
catch (IllegalBlockSizeException ex3) {System.out.println("c");
catch (BadPaddingException ex3) {System.out.println("e");
catch (NoSuchAlgorithmException ex1) {System.out.println("f");
catch (NoSuchPaddingException ex1) {System.out.println("g");
It cougth exception that "NoSuchAlgorithmException"
What wrong with line
Cipher cipher = Cipher.getInstance("RSA");
please tell me

Similar Messages

  • How to create my own Key for Rijndael (JCE Criptix)?

    I am developing a communication protocol and the key for encryption and decryption should be the user's password.
    This method generates a new RANDOM key:
    kg = KeyGenerator.getInstance("Rijndael");
    kg.init(256);
    k = kg.generateKey();
    The problem is that I need to specify my own key (the password).
    I'm tried: k = kg.generateKey(byte[] mykey), but don't work.
    Any suggestion?
    Thanks so much ...
    Leonel.

    Interesting. Looks like neither the Sun Provider nor BouncyCastle allow you to generate SecretKeySpecs for Rijndael. Surprised me.
    What you need is a Provider that gives you a SectretKeyFactory for Rijndael. A quick google on "rijndael secretkeyfactory" gave me this:
    http://www.informatik.tu-darmstadt.de/TI/Forschung/cdcProvider/overview.html
    and go here, specifically:
    http://www.informatik.tu-darmstadt.de/TI/Forschung/cdcProvider/current/std/docs/api/cdc/standard/CDCStandardProvider.html
    See if that'll work for you!
    Grant

  • How to create a account key for application type M ?

    Hi Guys,
    How to create a account key for application type M ? and link the same with
    Gl account.
    thanks.

    Hi
    Please create the account keys or transaction keys in
    SPRO-> IMG-> MM-> Purchasing-> Conditions-> Define Price Determination Process-> Define Transaction/Event Keys
    Thanks & Regards
    Kishore

  • How do I find the key for my time capsule router

    How do I find the key for my time capsule router

    Hello, see if these are of any help...
    http://www.iclarified.com/entry/index.php?enid=4547
    http://manuals.info.apple.com/en/TimeCapsule_SetupGuide.pdf
    If it's the Pre-Shared Key you're looking for, open Airport Utility, under the menu item Base Station, look for Equivalent Network Password.

  • 1809: An error has occured while generating a seccion key for encryption

    Hi
    I am trying to perform a remote control operation using Console One
    1.3.6c, but evry thime getting the following error message
    "1809: An error has occured while generating a seccion key for
    encryption." I had looked for it in Novell site & found that the fix is
    to upgrade to ZDF 6.5 SP1, but I am looking for a diffrent work around
    for it. Please let me know is there any work around for this problem.
    Regard
    Kallol
    kallol

    kallol,
    It appears that in the past few days you have not received a response to your
    posting. That concerns us, and has triggered this automated reply.
    Has your problem been resolved? If not, you might try one of the following options:
    - Do a search of our knowledgebase at http://support.novell.com/search/kb_index.jsp
    - Check all of the other support tools and options available at
    http://support.novell.com.
    - You could also try posting your message again. Make sure it is posted in the
    correct newsgroup. (http://support.novell.com/forums)
    Be sure to read the forum FAQ about what to expect in the way of responses:
    http://support.novell.com/forums/faq_general.html
    If this is a reply to a duplicate posting, please ignore and accept our apologies
    and rest assured we will issue a stern reprimand to our posting bot.
    Good luck!
    Your Novell Product Support Forums Team
    http://support.novell.com/forums/

  • How to change "No Password required" for Guest to "Yes"account under Somarsoft Dumpsec

    Check Content:
    Verify all accounts require passwords.
    Run the DUMPSEC utility.
    Select "Dump Users as Table" from the "Report" menu.
    Select the following fields, and click "Add" for each entry:
    UserName
    SID
    PswdRequired
    AcctDisabled
    Groups
    If any accounts have "No" in the "PswdRequired" column, this is a finding.
    Some built-in or application-generated accounts (e.g., Guest, IWAM_, IUSR, etc.) may not have this flag set, even though there are passwords present.  It can be set by entering the following on a command line: "Net user <account_name> /passwordreq:yes".

    Hi Malik,
    How to change "No Password required" for Guest to "Yes"account under Somarsoft Dumpsec
    Please contact SystemTools Technical support to get more efficient support regarding this matter:
    http://www.systemtools.com/support.htm
    http://www.systemtools.com/toolboard/
    Best Regards,
    Amy
    Please remember to mark the replies as answers if they help and un-mark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

  • How to change the sysadmin password for maintenance wizard if you have forg

    How to change the sysadmin password for maintenance wizard if you have forgotten the password and can't log in.

    Log into SQL*Plus as the $EOFUSER and do:
    update eof_user set password = 'passwd_you_want' where user_id = 0;
    commit;
    -Vikki
    Product and Development Manager for Maintenance Wizard

  • How to change the Display Pattern for Decimal Fields dynamically

    hi all,
    Can any one help me how to change the display pattern for decimal fields dynamically???
    Currently I am using z,zzz,zzz,zz9.999 Display pattern for Quantity Field. If the value is blank it is displaying as 0.000 on the Screen. But I don't want this to be printed.
    Please help me how to solve this ASAP.
    Thanks,
    Prabhu

    Hi,
    Alternatively you can handle it in the context.
    In the context area, click on the quantity. In the bottom, click on the conditions tab, and put a condition
    <quan field> NE initial.
    So the field will not be printed if there is no value.
    Regards,
    Vidya Chowdhary A.

  • How to change the package name for a msg class

    Can anybody tell me how to change the package name for a message class.
    and how will it effect in the rerport?
    thanks in advance
    kp

    >>and how will it effect in the report?
    You wouldn't see any direct effect on the Report.. But if you transport the report to QA & leave the Message class in Dev, it might result in syntax issues & you will not be able to execute the report. Just ensure that both of them get transported to QA & you will be fine.
    ~Suresh

  • How To Change Root Folder Reference for href - anythingslider links?

    How To Change Root Folder reference for href - anythingslider links?
    My root folder in Web Apps>Carousel in admin is set at /carousel/ (http://bestinscotland04.businesscatalyst.com/carousel/slide-2 - as an example) but I want it to link to a specific page at the root level (specifically /scottish-menswear/mens-highland-kilt-outfit).
    I can't find the controls, css, or html file to enable my picture to link to this product page.
    I'm sorry for the amateur question - I've never had formal training and it's always a reverse-engineering situation with me.
    Thank you.

    One way to address this is to use the Virtual Web Host feature.
    I've uploaded a simple application note to help guide you through the steps.
    An alternative would be to create an html at /Web/ which forwards to /Web/Joomla.  Not a great solution, I know.
    I'm sure there is a way to change the setting in a linux configuration file, but I don't know which file that is in.  Maybe some other linux savy community members could help out with that?

  • How to change the menu text for menu exit in Version 3.1i

    Hi,
    I am working on an enhancment in CJ02 transaction in 3.1i version. I have implimented menu exit for it , but I am unable to change the menu text for it.Please let me know how to change the menu text for that menu.
    Thanks
    Suman

    Hi Shree,
    Thanks for the response. Please find the Enhancement name here "CNEX0006".
    Thanks
    Suman

  • How to change the Safety Intervals for standard Content datasources

    Go to RSA2->give your datasource name ->setting up GEN delta
    It shows you whts the safety interval setting.
    <b>
    How to change the Safety Intervals for standard Content datasources since when I go to RSA2 edit and change options are always greyed out. let me know if there is any other transaction code or table to do this.</b>
    Thanks
    Soniya Kapoor

    Hi Soniya,
    1) try  RSA6.....also  RSA8 for additional info.
    2) useful link:
        http://help.sap.com/saphelp_nw04/helpdata/en/d0/4cc138944cfa06e10000000a11405a/content.htm
    Good luck, BB

  • How to change the account setting for App Store

    My last question wasn't so clear, so I would like to post again. I want to know how to change the account setting for App Store. I have changed in the Settings but it doesn't reflect in App Store.
    Thanks,

    once you sign out just click sign in and put the new email address in the "Username" field and your correct password then click OK
    it will look like it is doing nothing but give it time and it will sign you in with the new username.
    is it possible you have multiple itunes accounts?
    when you changed your itunes account from your me.com to your gmail.com address did you change it within the itunes Edit Account Info ('Store' menu then select 'View My Account', then sign in , select edit account info) or did you just create another itunes account?
    be well

  • How to change the browser used for Google search from context menu of selected text?

    How to change the browser used for Google search from context menu of selected text?
    It uses Safari. But I want to use Chrome (it's my default browser).

    How to change the browser used for Google search from context menu of selected text?
    It uses Safari. But I want to use Chrome (it's my default browser).

  • HT1689 How to change credit card account for purchasing

    How to change credit card account for purchasing

    On your computer's iTunes you should be able to edit your payment info by going into the Store > View Account menu option and logging into your account, and on your account's details page there should be a payment details link.  If you are doing it on an iOS device (iPad, iPhone or iPod Touch) then tap on your id in Settings > iTunes & App Store (Settings > Store on iOS 5 and below) and tap on 'View Apple ID' on the popup and log into your account  - that should also give you a payment details link on your account's page.
    Changing payment info : http://support.apple.com/kb/HT1918

Maybe you are looking for