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;
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
add a comment |
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
add a comment |
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
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
codenameone bouncycastle
asked Mar 27 at 9:07
JoanJoan
132 bronze badges
132 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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.
Yep that works I haven't thought about it many thanks Shai !
– Joan
Mar 28 at 7:19
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
Yep that works I haven't thought about it many thanks Shai !
– Joan
Mar 28 at 7:19
add a comment |
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.
Yep that works I haven't thought about it many thanks Shai !
– Joan
Mar 28 at 7:19
add a comment |
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.
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.
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
add a comment |
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
add a comment |
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.
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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