Code Monkey home page Code Monkey logo

Comments (2)

rustymagnet3000 avatar rustymagnet3000 commented on July 17, 2024 2

why would you want to do that @preetigaur ? The private key is your part of a non-repudiation claim...(i.e. the private key never leaves the leave possession of the holder, unless they lose phone and somebody compromises the device authentication).

The public key can be exported and shared with the server for verifying signatures of encrypting small payloads to be decrypted locally inside the iOS Secure Enclave.

from ellipticcurvekeypair.

hfossli avatar hfossli commented on July 17, 2024

This is currently not supported in this code base. If you want to we can make it happen! Are you a representing a company? We are considering opening up a patreon account. If you would like to know more about why we think a support contract is a good idea we support the rationale presented in these tweets. Would you be interested in supporting us?

We will anyways try our best to have a helpful and meaningful discussion. When it comes to your question it should be possible. Note that it is not possible to export nor import private keys stored on the secure enclave. So it would need to be stored in keychain. It should be fairly simple to get the raw data of the private key, but as you might have seen

// The open ssl compatible DER format X.509
//
// We take the raw key and prepend an ASN.1 headers to it. The end result is an
// ASN.1 SubjectPublicKeyInfo structure, which is what OpenSSL is looking for.
//
// See the following DevForums post for more details on this.
// https://forums.developer.apple.com/message/84684#84684
//
// End result looks like this
// https://lapo.it/asn1js/#3059301306072A8648CE3D020106082A8648CE3D030107034200041F4E3F6CD8163BCC14505EBEEC9C30971098A7FA9BFD52237A3BCBBC48009162AAAFCFC871AC4579C0A180D5F207316F74088BF01A31F83E9EBDC029A533525B
//
public lazy var DER: Data = {
var x9_62HeaderECHeader = [UInt8]([
/* sequence */ 0x30, 0x59,
/* |-> sequence */ 0x30, 0x13,
/* |---> ecPublicKey */ 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, // http://oid-info.com/get/1.2.840.10045.2.1 (ANSI X9.62 public key type)
/* |---> prime256v1 */ 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, // http://oid-info.com/get/1.2.840.10045.3.1.7 (ANSI X9.62 named elliptic curve)
/* |-> bit headers */ 0x07, 0x03, 0x42, 0x00
])
var result = Data()
result.append(Data(x9_62HeaderECHeader))
result.append(self.raw)
return result
}()
it is wise to structure the values in a format openssl and other libraries understand well. Some of the work would probably mean getting this right which may or may not be trivial.

Looking forward to hear from you

from ellipticcurvekeypair.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.