Comments (5)
Currently there is no way to import a private key, but public one works fine via the appropriate initialisers, is that what you have in mind?
from heimdall.
No, I'm afraid I need to handle private keys as well as public keys. In my application the keys are (encrypted) stored on the server to allow key synchronization between devices. The android part works fine but with iOS I'm kind of stuck trying to use an key received by the server.
from heimdall.
And the private-public key-pair we are talking about is an RSA pair? It might be possible to create an initialiser to take not only public key data, but also that of the private key. I suppose if that's the case, there's should also be a way to export the private key from an instance. I might look at this later this week/month.
As a side note, are you stuck importing the key into Keychain? The number one issue there is the difference in format, iOS is very picky about the different headers/metadata in the data, for example it doesn't like the X.509 headers for public keys when importing.
from heimdall.
I think that would be a great method to allow an self-handled set of keys.
The format is a real headache using swift/ios, I'm still not sure how to
convert an existing modulus/exponent key in string/decimal format to a SecKeyRef.
Happy for any advise..
Also reported here:
http://stackoverflow.com/questions/30759803/get-seckeyref-from-modulus-exponent
from heimdall.
From what I gather, there are more components to a private key than just the exponent and modulus (which are components of the public key):
http://stackoverflow.com/questions/25066752/how-do-i-extract-the-private-key-components-n-and-d-from-a-private-rsa-key
http://www.herongyang.com/Cryptography/OpenSSL-RSA-Viewing-Components-of-RSA-Keys.html
Assuming one had all of the required components of the private key, on iOS they would then need to convert them into PKCS#12 blob (.p12), which could then be imported into the keychain via SecPKCS12Import function resulting in types that the keychain understands and that can be used.
This, however, currently seems like too much work for Heimdall to do, it is meant to be as lightweight as possible and support the most common cases of having access to either locally generated keypair or a stored public key. If a key was somehow imported to a specific tag in the Keychain, Heimdall would be able to search for it, meaning that if you were able to import the private key, Heimdall might be able to work with it. For the time being I think this will be the extent of supporting imported private keys in Heimdall.
If you manage to import a private key to the Keychain, feel free to submit a pull request. Even if this functionality should be kept clear of Heimdall (for now, anyway), it could serve as a good category/extension/utility.
from heimdall.
Related Issues (20)
- generate RSA Key pair as string HOT 1
- How to not use OAEP? HOT 1
- How to decrypt the encrypted data by heimdall in Java server? HOT 1
- App containing Heimdall fails to upload to App Store HOT 2
- Xcode Warning HOT 1
- Possible octet encoding bug? HOT 2
- Compatibility with Crypto++ HOT 1
- Cocoapods: Absolute path in modulemap causes build issues on some machines HOT 2
- Not swift 3 ready? HOT 4
- Import private key from keystore HOT 1
- Use import Public-Key to verify signature HOT 1
- Nil on encrypt on XCode 9.0 HOT 1
- XCode 10: redefinition of module 'CommonCrypto' HOT 11
- error -9809 when verifying signed string HOT 9
- not work HOT 3
- Format of x509 HOT 1
- Heimdall fails to decrypt it's own data after upgrading to Xcode 11/iOS 13 SDK HOT 4
- could not find module 'Heimdall' for target 'arm64-apple-ios'; found: x86_64
- In Xcode 12.2 this is not working
- SPM Support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from heimdall.