RSA Key generation with SecKey Xamarin.iOS
I'm trying to generate a public (and private) key pair using the SecKey class from Xamarin.iOS.
The KeySize is defined to 1024 bit and this seems to work (if I change this value, the length of the result array is changing too).
I generate the keys with
SecKey.GenerateKeyPair(CreateRsaParams(), out publicKey, out privateKey);
byte key = publicKey.GetExternalRepresentation().ToArray()
(CreateRsaParams() is a function giving back a NSDictionary with the required data)
The problem is: I get a byte array (public key) with 140 Bytes - but depended on the key size it should have only 128 Byte - and I need a 128 Byte public key for data exchange with an other system
(by the way - using PCLCrypto is not an option for me since the project is not allowed to use this 3rd party component)
Does anyone know the problem and know a solution?
ios xamarin rsa public-key
add a comment |
I'm trying to generate a public (and private) key pair using the SecKey class from Xamarin.iOS.
The KeySize is defined to 1024 bit and this seems to work (if I change this value, the length of the result array is changing too).
I generate the keys with
SecKey.GenerateKeyPair(CreateRsaParams(), out publicKey, out privateKey);
byte key = publicKey.GetExternalRepresentation().ToArray()
(CreateRsaParams() is a function giving back a NSDictionary with the required data)
The problem is: I get a byte array (public key) with 140 Bytes - but depended on the key size it should have only 128 Byte - and I need a 128 Byte public key for data exchange with an other system
(by the way - using PCLCrypto is not an option for me since the project is not allowed to use this 3rd party component)
Does anyone know the problem and know a solution?
ios xamarin rsa public-key
Refer this blog msicc.net/tag/rsa
– Lucas Zhang - MSFT
Nov 23 '18 at 2:55
Thanks Lucas for the link. I already used most of the code from this blog. Now I changed completely to this code and use the key chain - but the result is the same 140 byte key. So the problem isn't solved.
– Peter
Nov 23 '18 at 10:32
add a comment |
I'm trying to generate a public (and private) key pair using the SecKey class from Xamarin.iOS.
The KeySize is defined to 1024 bit and this seems to work (if I change this value, the length of the result array is changing too).
I generate the keys with
SecKey.GenerateKeyPair(CreateRsaParams(), out publicKey, out privateKey);
byte key = publicKey.GetExternalRepresentation().ToArray()
(CreateRsaParams() is a function giving back a NSDictionary with the required data)
The problem is: I get a byte array (public key) with 140 Bytes - but depended on the key size it should have only 128 Byte - and I need a 128 Byte public key for data exchange with an other system
(by the way - using PCLCrypto is not an option for me since the project is not allowed to use this 3rd party component)
Does anyone know the problem and know a solution?
ios xamarin rsa public-key
I'm trying to generate a public (and private) key pair using the SecKey class from Xamarin.iOS.
The KeySize is defined to 1024 bit and this seems to work (if I change this value, the length of the result array is changing too).
I generate the keys with
SecKey.GenerateKeyPair(CreateRsaParams(), out publicKey, out privateKey);
byte key = publicKey.GetExternalRepresentation().ToArray()
(CreateRsaParams() is a function giving back a NSDictionary with the required data)
The problem is: I get a byte array (public key) with 140 Bytes - but depended on the key size it should have only 128 Byte - and I need a 128 Byte public key for data exchange with an other system
(by the way - using PCLCrypto is not an option for me since the project is not allowed to use this 3rd party component)
Does anyone know the problem and know a solution?
ios xamarin rsa public-key
ios xamarin rsa public-key
asked Nov 22 '18 at 10:21
PeterPeter
1
1
Refer this blog msicc.net/tag/rsa
– Lucas Zhang - MSFT
Nov 23 '18 at 2:55
Thanks Lucas for the link. I already used most of the code from this blog. Now I changed completely to this code and use the key chain - but the result is the same 140 byte key. So the problem isn't solved.
– Peter
Nov 23 '18 at 10:32
add a comment |
Refer this blog msicc.net/tag/rsa
– Lucas Zhang - MSFT
Nov 23 '18 at 2:55
Thanks Lucas for the link. I already used most of the code from this blog. Now I changed completely to this code and use the key chain - but the result is the same 140 byte key. So the problem isn't solved.
– Peter
Nov 23 '18 at 10:32
Refer this blog msicc.net/tag/rsa
– Lucas Zhang - MSFT
Nov 23 '18 at 2:55
Refer this blog msicc.net/tag/rsa
– Lucas Zhang - MSFT
Nov 23 '18 at 2:55
Thanks Lucas for the link. I already used most of the code from this blog. Now I changed completely to this code and use the key chain - but the result is the same 140 byte key. So the problem isn't solved.
– Peter
Nov 23 '18 at 10:32
Thanks Lucas for the link. I already used most of the code from this blog. Now I changed completely to this code and use the key chain - but the result is the same 140 byte key. So the problem isn't solved.
– Peter
Nov 23 '18 at 10:32
add a comment |
1 Answer
1
active
oldest
votes
Okay, problem solved.
If anyone is facing the same problem, you can find the solution at
https://forums.developer.apple.com/thread/111109
The problem was not the key, but the wrongly formulated requirement.
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%2f53428741%2frsa-key-generation-with-seckey-xamarin-ios%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
Okay, problem solved.
If anyone is facing the same problem, you can find the solution at
https://forums.developer.apple.com/thread/111109
The problem was not the key, but the wrongly formulated requirement.
add a comment |
Okay, problem solved.
If anyone is facing the same problem, you can find the solution at
https://forums.developer.apple.com/thread/111109
The problem was not the key, but the wrongly formulated requirement.
add a comment |
Okay, problem solved.
If anyone is facing the same problem, you can find the solution at
https://forums.developer.apple.com/thread/111109
The problem was not the key, but the wrongly formulated requirement.
Okay, problem solved.
If anyone is facing the same problem, you can find the solution at
https://forums.developer.apple.com/thread/111109
The problem was not the key, but the wrongly formulated requirement.
answered Nov 28 '18 at 13:14
PeterPeter
1
1
add a comment |
add a comment |
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%2f53428741%2frsa-key-generation-with-seckey-xamarin-ios%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
Refer this blog msicc.net/tag/rsa
– Lucas Zhang - MSFT
Nov 23 '18 at 2:55
Thanks Lucas for the link. I already used most of the code from this blog. Now I changed completely to this code and use the key chain - but the result is the same 140 byte key. So the problem isn't solved.
– Peter
Nov 23 '18 at 10:32