1
我需要將使用openssl生成的RSA公鑰轉換爲Android引導加載程序代碼中指定的格式。 在Android代碼庫中指定的格式是如何將openssl RSA密鑰轉換爲Android引導程序RSA密鑰格式?
typedef struct RSAPublicKeyInstance {
int len; // Length of n[] in number of uint32_t
uint32_t n0inv; // -1/n[0] mod 2^32
uint32_t n[RSANUMWORDS]; // modulus as little endian array
uint32_t rr[RSANUMWORDS]; // R^2 as little endian array
} RSAPublicKeyInstance;
請找原代碼here。 可以找到相關的C源文件rsa.c here。
如何轉換模量,從OpenSSL的恢復產生這樣
openssl rsa -pubin -inform PEM -text -noout < public.key
Modulus (2048 bit):
00:98:10:23:16:ff:b6:f4:26:a2:42:a6:19:23:0e:
0f:27:4a:b9:43:3d:a0:4b:b9:1b:1a:57:92:dd:a8:
bc:5d:b8:6e:e6:7f:0f:2e:89:a5:77:16:d1:cf:44:
69:74:2b:b1:a9:dd:72:bd:a8:9c:aa:90:ca:7b:f4:
d3:d3:db:11:98:bd:61:f1:2c:77:41:ad:c4:42:6a:
88:d1:37:04:12:a9:36:ec:09:34:0d:31:71:b9:5a:
ea:ed:ce:61:1c:1e:5f:6c:9e:28:ee:21:2a:e4:c6:
1f:75:29:78:a5:96:b1:53:17:4d:bf:88:d1:12:5c:
a6:75:aa:7c:fe:23:a8:dd:25:35:46:c6:8a:eb:2e:
e4:a3:1d:7f:b6:6d:9c:7d:66:59:84:c9:51:15:82:
67:a6:85:e9:c8:d6:2b:a7:e6:28:08:d2:b1:99:92:
67:32:c4:ba:f7:c9:1a:16:30:e5:cb:39:cb:96:28:
70:32:ba:18:d2:64:2f:74:3e:dd:09:e0:68:56:57:
cf:50:63:c0:95:a9:b0:5b:2a:ad:21:4f:bd:e7:15:
64:4a:9d:e4:c5:c3:5c:35:bf:e6:78:f4:8a:40:83:
da:7d:0d:6c:02:60:4a:3f:0c:9c:03:fd:48:e6:72:
f3:0d:5b:90:6b:de:59:58:c9:f4:26:4a:61:b4:52:
21:1d
Exponent: 65537 (0x10001)
公鑰到上述結構的格式?如何在結構中存儲有關公開指數的信息?請注意,我主要關心如何存儲模數和公開指數。 rr [RSANUMWORDS]對我來說是無關緊要的。
非常感謝!任何幫助表示讚賞。
謝謝!那可行。 – piscianemperor 2013-04-23 20:57:46
我發現AOSP另一個實用程序,被構建爲一個正常的構建的一部分,但你在DER格式的關鍵票代替: Java的罐子出/主機/ Linux的-86 /框架/ dumpkey.jar engineering_key.der – 2013-04-25 19:19:54