Post

Replies

Boosts

Views

Activity

CryptoKit sign payload and header with private key
I am trying to create a jwt token signed with Elliptic Curve Digital Signature Algorithm (ECDSA) with the P-256 curve and the SHA-256 hash algorithm. The payload and the header are created properly, but I am having problems signing it. The P256.Signing.PrivateKey(rawRepresentation: keyData) always returns nil. Can anyone please help? let privateKey = """ -----BEGIN ENCRYPTED PRIVATE KEY----- code -----END ENCRYPTED PRIVATE KEY----- """ let keyData = Data(base64Encoded: privateKey.toBase64())!     let header = jwtHeader()     let payload = jwtPayload()     let signingInput = "\(header).\(payload)"     let privateKey = try! P256.Signing.PrivateKey(rawRepresentation: keyData)     let sig = try! privateKey.signature(for: Data(signingInput.utf8)).rawRepresentation     return "\(signingInput).\(sig.base64URLEncodedString)" extension String {     func toBase64() -> String {         return Data(self.utf8).base64EncodedString()     } }
3
0
2.2k
Sep ’22
Can't remove build from appstoreconnect
I prepared a build to submit to App Store, then I needed to replace it with a newer one, but I don't see any "-" icon to remove this build, Is this appstoreconnect bug or I'm doing something wrong? There is newer version than 10th uploaded to Update: I could fix it, found in Submit review screen that I can remove the build from there.
Replies
0
Boosts
0
Views
693
Activity
Nov ’23
CryptoKit sign payload and header with private key
I am trying to create a jwt token signed with Elliptic Curve Digital Signature Algorithm (ECDSA) with the P-256 curve and the SHA-256 hash algorithm. The payload and the header are created properly, but I am having problems signing it. The P256.Signing.PrivateKey(rawRepresentation: keyData) always returns nil. Can anyone please help? let privateKey = """ -----BEGIN ENCRYPTED PRIVATE KEY----- code -----END ENCRYPTED PRIVATE KEY----- """ let keyData = Data(base64Encoded: privateKey.toBase64())!     let header = jwtHeader()     let payload = jwtPayload()     let signingInput = "\(header).\(payload)"     let privateKey = try! P256.Signing.PrivateKey(rawRepresentation: keyData)     let sig = try! privateKey.signature(for: Data(signingInput.utf8)).rawRepresentation     return "\(signingInput).\(sig.base64URLEncodedString)" extension String {     func toBase64() -> String {         return Data(self.utf8).base64EncodedString()     } }
Replies
3
Boosts
0
Views
2.2k
Activity
Sep ’22