Posts

Post not yet marked as solved
3 Replies
@gcharita , So what is the solution ? . I have tried to use SSH and i get a different error. see this post which i have raised in stackoverflow : https://stackoverflow.com/questions/65292586/swift-pcakage-manager-artifact-of-binary-target-failed-download-invalid-statu Otherwise if i use Personal access token how can i configure them in xcode ?
Post not yet marked as solved
3 Replies
Thanks for the reply. You are absolutely right the code I have shared is not full implementation but just a snippet. The point being I was trying to find out if my logic of generating the shared secret is the right way. Currently i am generating a private key using 3rd party library https://github.com/104corp/JOSE-ECDH-ES-SwiftIn my case I am generating a local key pair using belowlet publicKey = ECPublicKey(crv: .P256, x: xPubvalue, y: yPubvalue) let keyPair = try! generateECKeyPair(curveType: .P256)let sharedZ = try! JweHelper.ecdhDeriveBits(ecPrivJwk: keyPair.getPrivate(), ecPubJwk: publicKey, bitLen: 256)and the public key being created using x and y of stand EC public key. The reason for using this 3rd pary library is to save time converting the objects which is used inside the ecdhDeriveBits to generate shared secret.Questions1. Do you think the above approach is any different or wrong,2. Looking at your implementation how can I use a public key x and y instead of using SecKeyCopyPublicKey to generate a public key ?Also the implemettion which is working fine with chilkat, I can share the code but its too large to share the implementaion as the code is part of the project and other dependencies, Is there any other means I can share or speak directly to a Apple Developer if needed to get assitance on this ?Thanks
Post not yet marked as solved
3 Replies
Created a new issue here for pad block corrupted: https://forums.developer.apple.com/message/422604#422604
Post not yet marked as solved
3 Replies
Yes you are right i am trying to solve a problem related to generation of shared secret. I know apple has its own APIs for example using SecKeyCopyKeyExchangeResult to generate the shared secret. But when i tried that i was getting a error ( pad block corrupted on the server side ). So I thought of changing the generation of share secret using alternative methods to fix the pad block corrupted issue using hit and trial method.The reason for looking 32 byte key data from x and y was that the below code and library generates 32 bytes of public key data to then generate shared secret. In the below if we try to po alicePair?.publicKey then we get 32 bytes of data.//GMEllipticCurveCrypto let alicePair = GMEllipticCurveCrypto.generateKeyPair(for: GMEllipticCurveSecp256r1) let bobPair = GMEllipticCurveCrypto.generateKeyPair(for: GMEllipticCurveSecp256r1) let publicKeyAlice = alicePair?.publicKey let publicKeyBob = bobPair?.publicKey let shared1 = bobPair?.sharedSecret(forPublicKey: publicKeyAlice) let shared2 = alicePair?.sharedSecret(forPublicKey: publicKeyBob) if shared1 == shared2 { print("shared are same") } else { print("not matching") }I guess then , we can close this issue. Can I raise a new question one with pad block issue corrupted and I can then put my actual implementiion of shared key using SecKeyCopyKeyExchangeResult ?