Post

Replies

Boosts

Views

Activity

Convert key rawRepresentation to x963Representation to create SecKey
Hello Here is a problem with creating SecKey for ios 10 after key derivation (HMAC + sha512) After derivation we get 32 bytes of private key and chainCode There is no problem to use this bytes to create P256 private key with function from iOS13 try? P256.Signing.PrivateKey(rawRepresentation: bytes) and then to get x963Representation to create a SecKey But on iOS10 - 12 we don't have an ability to use this function... So I have to convert 32 bites key to 97 somehow to represent it in ANSI x9.63 format Example of key bytes [110, 181, 159, 0, 54, 16, 25, 129, 87, 128, 85, 36, 192, 64, 195, 4, 20, 47, 243, 134, 160, 57, 30, 210, 89, 225, 223, 114, 11, 121, 57, 156] x963Representation [4, 37, 167, 241, 121, 238, 41, 22, 35, 158, 89, 144, 215, 243, 4, 91, 217, 243, 23, 42, 171, 228, 247, 89, 136, 123, 22, 71, 11, 205, 134, 29, 110, 83, 241, 239, 135, 37, 226, 40, 179, 11, 191, 193, 232, 124, 41, 160, 136, 53, 95, 33, 233, 207, 151, 83, 136, 234, 97, 4, 79, 115, 227, 69, 42, 252, 66, 68, 64, 32, 176, 11, 75, 206, 158, 228, 246, 9, 179, 36, 94, 186, 209, 125, 152, 192, 192, 141, 242, 200, 108, 181, 75, 103, 86, 171, 231] I see that x963Representation contains: header(04) + ? + ? + 32_Key_Bytes So the question is - how to count x and y to get the key form (04 || X || Y || K) to be able to create SecKey?
1
0
813
Sep ’23