RSA KeyPairGenerator problems on Android and iOS
- Dominant language
- Java
- Stars
- 6k
- Forks
- 999
- Avg merge
- 19h 20m
- Merged PRs (30d)
- 14
Description
Hi, I wrote a code for generate a KeyPair in RSA and translated it to ObjC.
When I exec both methods on Android and iOS the key length differs a lot (about half lenght on Android).
If I try to re-create an iOS key on Android it fails with the following error:
```
java.security.spec.InvalidKeySpecException: java.lang.RuntimeException: error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag
at com.android.org.conscrypt.OpenSSLKey.getPrivateKey(OpenSSLKey.java:180)
at com.android.org.conscrypt.OpenSSLRSAKeyFactory.engineGeneratePrivate(OpenSSLRSAKeyFactory.java:64)
at java.security.KeyFactory.generatePrivate(KeyFactory.java:187)
```
i.e. here the generated public keys on RSA with 1024 bits:
```
iOS
MIIBCgKCAQEAtOTxzjNZFs8hg8p3ubBlO4Etc+/V22+KfEG5qlIwcDgZ4zKXO0y2QLJVRKH+C7Es
lKmGO5/pVTDu2PwQmNU5LrhHRz5mhC09ukSIk8PSHtP0eGqkJSbfRJ+eb+adAzf7L0megebnBGji
YSJvUtk/5W4k2hNkTf4qk/xnLcJiwFQ2bdx6yAIZWvq+VMa5rYFaemu2d8RzgXuK8KCuU6Z+0t9u
kOe6KPkIhbdZY/xcSlTrDZS42y6Jkoaxop8VFRC2ra0Lzayj97QbvZxesLSQ1z4ttfky8aKxVbot
30C3KXGkSlBg/xD0/70iclYfZ4jACCUfoAGqHziGmuUPqf4FHwIDAQAB
/////
ANDROID
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDVhIGvK2mfSukkAO+kL3VMKcFGUyKKS9p6+4LH
ZMoNnUppHWtcLmmbbaI33xj41c/uQonl2nTzQU4yWxioU5D06vuh6O5mLLIdnY97kDWqKy0tBdnX
fVVlyf772hx6zwam5OQg2qcQw6gaZGLjL4T6+bFn5wNSlwYxFPNT2d/X0wIDAQAB
```
Contributor guide
Assessment
This issue has not been assessed yet.