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
1.6k
Sep ’22
Network Extension Capability
i am trying to make simple content filter as proof of concept and for debugging i should use real device , when i run the project on device Xcode returns this error "Personal development teams , including 'My Name' do not support Network Extensions Capability" , as i guess i should be an apple developer for not having this error , but is there a way to debugg the project while i am just trying to proof the concept?
1
0
1.8k
Mar ’21