-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can I set the public key form a string which is the 'pkcs1-public-der'? #9
Comments
looks like you need to find some way to extra raw rsa components from der format.
This lib doesn't do key format import or export. It mainly support encrypt & decrypt using raw keys.
Hao Wang
On Jul 20, 2017, at 11:57 AM, Hugo Mosh Cardoza <notifications@github.com<mailto:notifications@github.com>> wrote:
I have the public key from a redbear/Duo an it is in pkcs1-public-der
The Duo Documentation says:
Response string (e.g.) : {"b":"ascii hex-encoded data","r":0} // 0 ok, non zero problem with index/data
The device's public key is in DER format.
And I need to do with react-native-rsa this, instead the node-rsa
var RSA = require('node-rsa');
...
SoftAP.prototype.publicKey = function publicKey(cb) {
is(cb);
this.__sendCommand({ name: 'public-key' }, function response(err, dat) {
checkResponse(err, dat, cb);
var buff = new Buffer(dat.b, 'hex');
this.__publicKey = new RSA(buff.slice(22), 'pkcs1-public-der', {
encryptionScheme: 'pkcs1'
});
cb(null, this.__publicKey.exportKey('pkcs8-public'));
}.bind(this));
};
It is my first time using keys, I will appreciate any help.
Thanks
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<#9>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ABjVgwJaLQqw8Y5-zYUMbkHsOe_G-xelks5sP6MegaJpZM4Oeh7a>.
|
Thanks
Yes we ended up using ASN1 js library to obtain the sequence of n and exp
El El jue, 20 de julio de 2017 a la(s) 15:52, hao-wang <
notifications@github.com> escribió:
… looks like you need to find some way to extra raw rsa components from der
format.
This lib doesn't do key format import or export. It mainly support encrypt
& decrypt using raw keys.
Hao Wang
On Jul 20, 2017, at 11:57 AM, Hugo Mosh Cardoza ***@***.***
***@***.***>> wrote:
I have the public key from a redbear/Duo an it is in pkcs1-public-der
The Duo Documentation says:
Response string (e.g.) : {"b":"ascii hex-encoded data","r":0} // 0 ok, non
zero problem with index/data
The device's public key is in DER format.
And I need to do with react-native-rsa this, instead the node-rsa
var RSA = require('node-rsa');
...
SoftAP.prototype.publicKey = function publicKey(cb) {
is(cb);
this.__sendCommand({ name: 'public-key' }, function response(err, dat) {
checkResponse(err, dat, cb);
var buff = new Buffer(dat.b, 'hex');
this.__publicKey = new RSA(buff.slice(22), 'pkcs1-public-der', {
encryptionScheme: 'pkcs1'
});
cb(null, this.__publicKey.exportKey('pkcs8-public'));
}.bind(this));
};
It is my first time using keys, I will appreciate any help.
Thanks
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<
#9>, or mute the
thread<
https://github.com/notifications/unsubscribe-auth/ABjVgwJaLQqw8Y5-zYUMbkHsOe_G-xelks5sP6MegaJpZM4Oeh7a>.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#9 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA21evwdyzyMpMA-Hpyr5UptX-XLzboEks5sP74egaJpZM4Oeh7a>
.
|
Hey @hugomosh I'm currently faced with the exact same problem. Would you mind sharing some information how you got it to work for you? |
@hugomosh @lukasklein hey guys, I'm a bit stuck on this too. Any help would be appreciated. I just keep getting Invalid Key messages from this library and need to figure out how to extract the raw keys. I'm also getting some errors about 'assert' not existing in the Haste module map when using the asn1 package. Did you find a specific package that worked? |
circling back here in case someone finds this later... I was able to figure out the location of the modulus and exponent using an online decoder, and then wrote the following function to grab those values and pass them to this module:
|
I have the public key from a redbear/Duo an it is in pkcs1-public-der
The Duo Documentation says:
And I need to do with react-native-rsa this, instead the node-rsa
It is my first time using keys, I will appreciate any help.
Thanks
The text was updated successfully, but these errors were encountered: