Hi eskimo !
Thanks a lot for your precious help !
I read the 2 links you mentioned in your earlier posts and followed the procedure as below -
From given pem file, I created a .der file.
openssl ec -in privateKey_encoded.pem -outform DER -out privateKey_encoded.der
which gave me privateKey_encoded.der file.
Then I did following :
xxd -p privateKey_encoded.der
which gave following -
307702010104202be46bb8e45619c112c025bf1ee1e82a0e29c74badd0a6
98aa75cb35b04e1852a00a06082a8648ce3d030107a14403420004b33ee9
0c5e9c3fea406ebfcf94b9a9f012d46aa8f2b42f7a9b92de01fec3b84397
9398a243dbf0a0c9172db33ea49ab96c295e11c52fed2bbfb183987943be
d9
(The presence of the leading 0x30 is a common indicator that you’re looking at DER-encoded ASN.1)
I tried to decode the private key to confirm the exact format its in. (using dumpans1.c tool as you recommended)
./dumpasn1 -p -a privateKey_encoded.der
which gave following output:
SEQUENCE {
INTEGER 1
OCTET STRING
2B E4 6B B8 E4 56 19 C1 12 C0 25 BF 1E E1 E8 2A
0E 29 C7 4B AD D0 A6 98 AA 75 CB 35 B0 4E 18 52
[0] {
OBJECT IDENTIFIER '1 2 840 10045 3 1 7'
}
[1] {
BIT STRING
04 B3 3E E9 0C 5E 9C 3F EA 40 6E BF CF 94 B9 A9
F0 12 D4 6A A8 F2 B4 2F 7A 9B 92 DE 01 FE C3 B8
43 97 93 98 A2 43 DB F0 A0 C9 17 2D B3 3E A4 9A
B9 6C 29 5E 11 C5 2F ED 2B BF B1 83 98 79 43 BE
D9
}
}
(This is an ASN.1 ECPrivateKey structure)
It is prime256v1 (1 2 840 10045 3 1 7)
Now comes importing the key.
I read the link you provided, but I did not understand how should I proceed importing the key.
My questions are -
From the above got BIT STRING, how can I create privateKey_encoded.dat file ? Is that the way to proceed further? I mean is that what I need to do in order to import the private key ?
From the link you gave (https://developer.apple.com/forums/thread/680572) which section do I need to refer to proceed for importing the private key?
Topic:
Privacy & Security
SubTopic:
General
Tags: