Can I get the modulus or exponent from a SecKeyRef object in Swift?

后端 未结 9 2042
灰色年华
灰色年华 2020-12-05 13:34

In Swift, I created a SecKeyRef object by calling SecTrustCopyPublicKey on some raw X509 certificate data. This is what this SecKeyRef object looks like.

<
9条回答
  •  借酒劲吻你
    2020-12-05 14:30

    SecKeyRefis a struct so there is a chance that it can be reflected with Mirror() to retrieve the wanted values.

    struct myStruct {
    let firstString = "FirstValue"
    let secondString = "SecondValue"}
    
    let testStruct = myStruct()
    let mirror = Mirror(reflecting: testStruct)
    
    for case let (label?, value) in mirror.children {
        print (label, value)
    }
    
    /**
    Prints: 
    firstString FirstValue
    secondString SecondValue
    */
    

提交回复
热议问题