Store keypair in the device in codename one appHow can I sign a file using RSA and SHA256 with .NET?PBKDF2 with bouncycastle in JavaGenerate GOST 34.10-2001 keypair and save it to some keystoreStoring nested objects using codenameone storageECDSA signature generation using secp256r1 curve and SHA256 algorithm - BouncyCastleWhy does Key.getAlgorithm return a different result after saving and reloading the KeyStoreLoading previously stored Keys fails in BouncyCastle with JavaHow can i import RSACryptoServiceProvider private key to bouncy castleUnexpected result decrypting using PHP AES CCM modeInconsistent public key derivation between elliptic (JS lib) and Bouncy Castle (.NET lib)

Project Euler Problem 45

A Meal fit for a King

How can I describe hit point damage without talking about wounds?

Draw the ☣ (Biohazard Symbol)

Why would a hard-tail guitar need a locking nut?

MOSFET broke after attaching capacitor bank

Comparing elements in a nested list to generate a new list

Is a paralyzed creature limp or rigid?

Do 643,000 Americans go bankrupt every year due to medical bills?

Why do old games use flashing as means of showing damage?

Fantasy Military Arms and Armor: the Dwarven Grand Armory

Would you recommend a keyboard for beginners with or without lights in keys for learning?

Travel to USA with a stuffed puppet

What are some countries where you can be imprisoned for reading or owning a Bible?

Did the US Climate Reference Network Show No New Warming Since 2005 in the US?

Why do we need explainable AI?

How can I implement regular expressions on an embedded device?

When is it legal to castle moving the rook first?

What quests do you need to stop at before you make an enemy of a faction for each faction?

Why is a pressure canner needed when canning?

Was "The Hobbit" ever abridged?

Are language and thought the same?

Is the Levitate spell supposed to basically disable a melee-based enemy?

Numerical minimum of a one-valued function



Store keypair in the device in codename one app


How can I sign a file using RSA and SHA256 with .NET?PBKDF2 with bouncycastle in JavaGenerate GOST 34.10-2001 keypair and save it to some keystoreStoring nested objects using codenameone storageECDSA signature generation using secp256r1 curve and SHA256 algorithm - BouncyCastleWhy does Key.getAlgorithm return a different result after saving and reloading the KeyStoreLoading previously stored Keys fails in BouncyCastle with JavaHow can i import RSACryptoServiceProvider private key to bouncy castleUnexpected result decrypting using PHP AES CCM modeInconsistent public key derivation between elliptic (JS lib) and Bouncy Castle (.NET lib)






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















I'm currently trying the codename one framework and I would like to know if there was a way to store keypair generated by the bouncy castle library by any chance ?



I tried to store keys using Storage and Preferences but always resulting the same Exception



java.io.IOException: Object type not supported: org.bouncycastle.asn1.pkcs.RSAPublicKey value: org.bouncycastle.asn1.pkcs.RSAPublicKey@581c
at com.codename1.io.Util.writeObject(Util.java:481)
at com.codename1.io.Storage.writeObject(Storage.java:227)









share|improve this question






























    2















    I'm currently trying the codename one framework and I would like to know if there was a way to store keypair generated by the bouncy castle library by any chance ?



    I tried to store keys using Storage and Preferences but always resulting the same Exception



    java.io.IOException: Object type not supported: org.bouncycastle.asn1.pkcs.RSAPublicKey value: org.bouncycastle.asn1.pkcs.RSAPublicKey@581c
    at com.codename1.io.Util.writeObject(Util.java:481)
    at com.codename1.io.Storage.writeObject(Storage.java:227)









    share|improve this question


























      2












      2








      2


      1






      I'm currently trying the codename one framework and I would like to know if there was a way to store keypair generated by the bouncy castle library by any chance ?



      I tried to store keys using Storage and Preferences but always resulting the same Exception



      java.io.IOException: Object type not supported: org.bouncycastle.asn1.pkcs.RSAPublicKey value: org.bouncycastle.asn1.pkcs.RSAPublicKey@581c
      at com.codename1.io.Util.writeObject(Util.java:481)
      at com.codename1.io.Storage.writeObject(Storage.java:227)









      share|improve this question














      I'm currently trying the codename one framework and I would like to know if there was a way to store keypair generated by the bouncy castle library by any chance ?



      I tried to store keys using Storage and Preferences but always resulting the same Exception



      java.io.IOException: Object type not supported: org.bouncycastle.asn1.pkcs.RSAPublicKey value: org.bouncycastle.asn1.pkcs.RSAPublicKey@581c
      at com.codename1.io.Util.writeObject(Util.java:481)
      at com.codename1.io.Storage.writeObject(Storage.java:227)






      codenameone bouncycastle






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 27 at 9:07









      JoanJoan

      132 bronze badges




      132 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          0
















          You need to save the byte array related to the key and not the key object. E.g.



          byte[] b = key.toASN1Primitive().getEncoded();


          And to restore:



          RSAPublicKey key = RSAPublicKey.getInstance(b);


          Haven't tried it but looking at the code I think this should work.






          share|improve this answer

























          • Yep that works I haven't thought about it many thanks Shai !

            – Joan
            Mar 28 at 7:19










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55373370%2fstore-keypair-in-the-device-in-codename-one-app%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0
















          You need to save the byte array related to the key and not the key object. E.g.



          byte[] b = key.toASN1Primitive().getEncoded();


          And to restore:



          RSAPublicKey key = RSAPublicKey.getInstance(b);


          Haven't tried it but looking at the code I think this should work.






          share|improve this answer

























          • Yep that works I haven't thought about it many thanks Shai !

            – Joan
            Mar 28 at 7:19















          0
















          You need to save the byte array related to the key and not the key object. E.g.



          byte[] b = key.toASN1Primitive().getEncoded();


          And to restore:



          RSAPublicKey key = RSAPublicKey.getInstance(b);


          Haven't tried it but looking at the code I think this should work.






          share|improve this answer

























          • Yep that works I haven't thought about it many thanks Shai !

            – Joan
            Mar 28 at 7:19













          0














          0










          0









          You need to save the byte array related to the key and not the key object. E.g.



          byte[] b = key.toASN1Primitive().getEncoded();


          And to restore:



          RSAPublicKey key = RSAPublicKey.getInstance(b);


          Haven't tried it but looking at the code I think this should work.






          share|improve this answer













          You need to save the byte array related to the key and not the key object. E.g.



          byte[] b = key.toASN1Primitive().getEncoded();


          And to restore:



          RSAPublicKey key = RSAPublicKey.getInstance(b);


          Haven't tried it but looking at the code I think this should work.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 28 at 3:43









          Shai AlmogShai Almog

          43.1k5 gold badges26 silver badges55 bronze badges




          43.1k5 gold badges26 silver badges55 bronze badges















          • Yep that works I haven't thought about it many thanks Shai !

            – Joan
            Mar 28 at 7:19

















          • Yep that works I haven't thought about it many thanks Shai !

            – Joan
            Mar 28 at 7:19
















          Yep that works I haven't thought about it many thanks Shai !

          – Joan
          Mar 28 at 7:19





          Yep that works I haven't thought about it many thanks Shai !

          – Joan
          Mar 28 at 7:19








          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55373370%2fstore-keypair-in-the-device-in-codename-one-app%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript