Posts

Post not yet marked as solved
1 Replies
1.1k Views
Hello,I am trying to encode and decode binary data in an 2D readable Barcode (e.g Aztec).Unfortunately I cant get it running and I couldn't find something that helped me.Since iOS 11 it should be possible to create barcodes with binary content due to this apple release notes: https://developer.apple.com/library/archive/releasenotes/General/WhatsNewIniOS/Articles/iOS_11_0.html"Added APIs to AV Foundation, Core Image, and SiriKit to support detection, decoding, and creation of barcodes with binary content."To generate an Aztec Code image, I used the following code snippet:let binaryData = Data([UInt8](arrayLiteral: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)) guard let filter = CIFilter(name: "CIAztecCodeGenerator") else { return nil } filter.setValue(binaryData, forKey: "inputMessage") guard let image = filter.outputImage else { return nil }I now can use the image and show it in an UIImageView. It shows a nice Aztec code.But I have a problem, when decoding the Aztec code back to binary. I am using the the iphone camera and a AVCaptureSession with an AVMetadataOutput. The detection of the aztec code works fine, but in the delegate function, I am not able to retrieve the actually binary datafunc metadataOutput(_ output: AVCaptureMetadataOutput, didOutput metadataObjects: [AVMetadataObject], from connection: AVCaptureConnection) { captureSession.stopRunning() if let metadataObject = metadataObjects.first { guard let readableObject = metadataObject as? AVMetadataMachineReadableCodeObject else { return } guard let descriptor = readableObject.descriptor as? CIAztecCodeDescriptor else {return} // here I dont get the correct raw bytes (0x01 -0x06) // Instead I only get this: e8864298f0000000 let rawBytes = descriptor.errorCorrectedPayload print(rawBytes) let dataString = rawBytes.hex print("dataString: \(dataString)") guard let stringValue = readableObject.stringValue else { return } } }I am not able to get the correct raw bytes (0x01, 0x02, 0x03, 0x04, 0x05, 0x06). The "stringValue" is empty, because the encoded bytes are binary data and are not a valid string.Are the raw bytes (e8864298f0000000) somehow encrypted or encoded in a special format?Best regardsJulian
Posted
by julian144.
Last updated
.
Post not yet marked as solved
3 Replies
1.9k Views
Hello,I am using the secure enclave to generate an EC keypair. Now my question is, when are the keys deleted? Because when I uninstall my application and install it again, the key is still available. I can't find anything in the documentation that would explain how it should behave.Can I count on it, that once I have created a key-pair, that it will always be available? Wouldn't that mean that the secure enclave will somehow have lots of keys that are propably not used anymore (e.g from apps that have been uninstalled long time ago).
Posted
by julian144.
Last updated
.