<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Edison Lo on Medium]]></title>
        <description><![CDATA[Stories by Edison Lo on Medium]]></description>
        <link>https://medium.com/@edisonlo?source=rss-588c94c86fc8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*-c7P4L9kYw-RVoXqS1rLpQ@2x.jpeg</url>
            <title>Stories by Edison Lo on Medium</title>
            <link>https://medium.com/@edisonlo?source=rss-588c94c86fc8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 14:36:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@edisonlo/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Some thoughts about the universe]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@edisonlo/some-thoughts-about-the-universe-35dcf8aa2a40?source=rss-588c94c86fc8------2"><img src="https://cdn-images-1.medium.com/max/849/1*eCIVWwtwsz_YXIHUlxaSbQ.png" width="849"></a></p><p class="medium-feed-snippet">Recently read a post on Facebook about the pattern of nature,</p><p class="medium-feed-link"><a href="https://medium.com/@edisonlo/some-thoughts-about-the-universe-35dcf8aa2a40?source=rss-588c94c86fc8------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@edisonlo/some-thoughts-about-the-universe-35dcf8aa2a40?source=rss-588c94c86fc8------2</link>
            <guid isPermaLink="false">https://medium.com/p/35dcf8aa2a40</guid>
            <category><![CDATA[time]]></category>
            <category><![CDATA[space]]></category>
            <category><![CDATA[deep]]></category>
            <category><![CDATA[space-exploration]]></category>
            <category><![CDATA[thoughts]]></category>
            <dc:creator><![CDATA[Edison Lo]]></dc:creator>
            <pubDate>Mon, 05 Oct 2020 15:25:55 GMT</pubDate>
            <atom:updated>2020-10-05T15:25:55.899Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[iOS framework file was built for x86_64 which is not the architecture being linked (arm64), linker…]]></title>
            <link>https://medium.com/@edisonlo/ios-framework-file-was-built-for-x86-64-which-is-not-the-architecture-being-linked-arm64-linker-4d3780669aa3?source=rss-588c94c86fc8------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d3780669aa3</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[framework]]></category>
            <category><![CDATA[objetive-c]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Edison Lo]]></dc:creator>
            <pubDate>Wed, 07 Mar 2018 04:27:47 GMT</pubDate>
            <atom:updated>2019-05-31T15:01:52.822Z</atom:updated>
            <content:encoded><![CDATA[<h3>iOS framework file was built for <strong>x86_64</strong> which is not the architecture being linked (<strong>arm64</strong>), linker command failed with exit code 1</h3><p>This is a common error when you deal with frameworks. Most people just follow the solutions on stackoverflow(Set <strong>Build Active Architecture Only </strong>to<strong> NO</strong>, and add i386, x86_64 to the valid architecture), but indeed it does not take much time to understand the rationale in behind.</p><h3><strong>1. Architecture in iOS</strong></h3><blockquote>armv64: iPhoneX, iPhone 5s-8, iPad Air — iPad Pro</blockquote><blockquote>armv7 : iPhone3Gs-5c, iPad WIFI(4th gen)</blockquote><blockquote>armv6 : iPhone — iPhone3G</blockquote><blockquote>the above if for real devices</blockquote><blockquote>i386 : 32-bit simulator</blockquote><blockquote>x86_64 : 64-bit simulator</blockquote><p>the above list is downward compatible, which means iPhoneX can runs with armv6 as well, and just can not fully utilize the functions of armv64</p><p>more info about iOS architectures can be found here:</p><p><a href="https://developer.apple.com/library/content/documentation/DeviceInformation/Reference/iOSDeviceCompatibility/DeviceCompatibilityMatrix/DeviceCompatibilityMatrix.html">Device Compatibility</a></p><h3><strong>2. What is Build Active Architecture Only?</strong></h3><p>If selected “Yes”, it will only build your framework to the “selected device”, either real devices(armv) or simulator(x86_64 or i386). For “No”, it will build your framework to your list of “Valid Architectures”</p><p>By default, in debug mode, it is “Yes”; and in release more, it is “No”, which can save compiling time in debug mode and ensure your release project framework runs on all architectures that you specified.</p><p>Thats why the accepted answer worked by forcing the framework to build for all architectures, however by reading more you will know what is behind and can definitely save time in compiling your framework. Of course, more control in yourself as well.</p><p>So, if you are working on a framework, and want to import to another project, if you compile the framework with <strong>Build Active Architecture Only</strong> “Yes” with <strong>simulator(i386 or x86_64)</strong>, and then import to your project with <strong>Build Active Architecture Only</strong> “Yes” with <strong>a real device(armv)</strong>, you will encountered this error.</p><p>Looking to the error description:</p><blockquote>file was built for <strong>x86_64</strong> which is not the architecture being linked (<strong>i386</strong>) will imply you build your framework in 64-bit simulator and your merged project build with 32-bit simulator.</blockquote><p>while a more common would be:</p><blockquote><em>framework file was built for </em><strong><em>x86_64</em></strong><em> which is not the architecture being linked (</em><strong><em>arm64</em></strong><em>): which implies your framework is built in simulator while your merged project is build with real device.</em></blockquote><h3><strong>3. Extracting the framework</strong></h3><p>A common practice would be right click the framework and select <strong>Show In Finder</strong>, while most developers keep the <strong>Finder</strong> open, and the newly compiled framework will replace the old one, without closing <strong>Finder</strong> and reopen again. Yes it is right, but if you switched the build target device in between, the frameworks will result in <strong>different folders</strong>. Sometimes you think you have compiled your framework but indeed it is in another folder. My suggestions would be always select <strong>Show in Finder</strong> to prevent the framework you import is not the latest one.</p><p>The two different folders: <strong>Debug-iphoneos</strong> and <strong>Debug-iphonesimulator</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t9aIgZrb84FpwxS2Jow4KA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6g42jmhNwhQ0uB2Xppzr0A.png" /></figure><p>From now on, you should be confident when encountering the framework link error issues, cheers mate.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d3780669aa3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[iOS objective c, swift bypass proxy]]></title>
            <link>https://medium.com/@edisonlo/ios-objective-c-swift-bypass-proxy-eacba5506f2f?source=rss-588c94c86fc8------2</link>
            <guid isPermaLink="false">https://medium.com/p/eacba5506f2f</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[bypass]]></category>
            <category><![CDATA[proxy]]></category>
            <category><![CDATA[objective-c]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Edison Lo]]></dc:creator>
            <pubDate>Mon, 15 Jan 2018 10:53:05 GMT</pubDate>
            <atom:updated>2018-01-15T10:53:30.134Z</atom:updated>
            <content:encoded><![CDATA[<p>Encountered a situation that i need to bypasss some proxy servers, and while testing in simulator, it works great because the “Setting” in Mac can let you bypass proxy manually. But when it runs on real devices, it couldnt because no setting for bypassing proxy manually. And then i spent some time searching for solutions and found out no one has ever posted a solution for this, probably this situation are quite weird to encounter. Anyway, after digging in the apple document, here are the solutions:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5a6be56457784b20e7c7226113d802a4/href">https://medium.com/media/5a6be56457784b20e7c7226113d802a4/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/755c0328469fcbc45738c700ccbd49ed/href">https://medium.com/media/755c0328469fcbc45738c700ccbd49ed/href</a></iframe><p>continue reading:<a href="https://developer.apple.com/documentation/cfnetwork/kcfstreampropertyproxylocalbypass">https://developer.apple.com/documentation/cfnetwork/kcfstreampropertyproxylocalbypass</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eacba5506f2f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Swift Easy DateTime and String Conversion]]></title>
            <link>https://medium.com/@edisonlo/swift-easy-datetime-and-string-conversion-9ce76cf2da8e?source=rss-588c94c86fc8------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ce76cf2da8e</guid>
            <category><![CDATA[confusion]]></category>
            <category><![CDATA[string]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[date]]></category>
            <dc:creator><![CDATA[Edison Lo]]></dc:creator>
            <pubDate>Tue, 31 Oct 2017 09:04:55 GMT</pubDate>
            <atom:updated>2017-10-31T09:19:07.149Z</atom:updated>
            <content:encoded><![CDATA[<p>There are a lot of time comes to me to deal with the time. It is not a hard stuff but probably quite confusing at the first few times.</p><p>Common case: you receive a time string, and needed to convert it to a Date object for further operation.</p><p>Steps:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e0ab35b8285985045a261e13c91d5659/href">https://medium.com/media/e0ab35b8285985045a261e13c91d5659/href</a></iframe><p>The confusion comes at when you JUST PRINT the day, no matter what timezone you specified, it will be use the +0000 time zone. However, everything will be ok when you pass the date to the DateComponents and get the mins, hours, day, month from it.</p><p>Check out</p><p><a href="https://github.com/edisonlo/SwiftDateTimeStringConverter/">edisonlo/SwiftDateTimeStringConverter</a></p><p>for complete Date to String converting functions if you are interested.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ce76cf2da8e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Objective-C ECDSA Signing and Verification, from .PEM, .DER or base64 string]]></title>
            <link>https://medium.com/@edisonlo/objective-c-digital-signature-signing-and-verification-with-pem-der-or-base64-string-aff4c0a7f805?source=rss-588c94c86fc8------2</link>
            <guid isPermaLink="false">https://medium.com/p/aff4c0a7f805</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[objective-c]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[digital-signatures]]></category>
            <category><![CDATA[ssl]]></category>
            <dc:creator><![CDATA[Edison Lo]]></dc:creator>
            <pubDate>Mon, 16 Oct 2017 08:57:45 GMT</pubDate>
            <atom:updated>2017-10-31T09:37:09.456Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently, i have been given a task to do digital signature on Elliptic Curve verification, and i found it is ridiculously hard to do in Swift.</p><p>My Situation is i have to verify a digital signature signed by Elliptic Curve with SHA-512, and the internet is completely lack of the support, which i spent a crazy amount of time to finally come up with a solution.</p><p>I have first tried to follow the Certificate, Key, and Trust Services Programming Guide at</p><p><a href="https://developer.apple.com/library/content/documentation/Security/Conceptual/CertKeyTrustProgGuide/Signing.html">Certificate, Key, and Trust Services Programming Guide: Signing and Verifying</a></p><p>;and also the library GMEllipticCurverCrypto at</p><p><a href="https://github.com/ricmoo/GMEllipticCurveCrypto">ricmoo/GMEllipticCurveCrypto</a></p><p>and also the Apple CyptoExercise at</p><p><a href="https://developer.apple.com/library/content/samplecode/CryptoExercise/Introduction/Intro.html">CryptoExercise</a></p><p>But none of this helped. The ECDSA signing and verification is ridiculously lack of support. Here is my quick solution and explanation with the use of openssl(which is already pre-installed in mac)</p><blockquote>1. Generate a key (the curve prime256v1 will work, but secp256k1 WONT)</blockquote><p>openssl ecparam -out eckey.pem -name prime256v1 -genkey</p><blockquote>2. Generate a cert signing request from the key(the challenging password is for installing or re-installing the cert, but this is not case we concern here)</blockquote><p>openssl req -new -key eckey.pem -out ecCertReq.csr</p><blockquote>3. Sign the SSL Certificate</blockquote><p>openssl x509 -req -days 365 -in ecCertReq.csr -signkey eckey.pem -out ecCert.crt</p><blockquote>4. Create public key for iOS</blockquote><p>openssl x509 -outform der -in ecCert.crt -out ec_public_key.de</p><blockquote>5. Create private key for iOS(*pls remember the password here, it will be used for accessing this ec_private_key.p12)</blockquote><p>openssl pkcs12 -export -out ec_private_key.p12 -inkey eckey.pem -in ecCert.crt</p><blockquote>6. Create public key for Android</blockquote><p>openssl ec -in eckey.pem -out ec_public_key.pem -pubout</p><blockquote>7. Create private key for android</blockquote><p>openssl pkcs8 -topk8 -in eckey.pem -out pkcs8_private_key.pem -nocrypt</p><p>So, you see that there are different key files. Short explanation</p><p>To create the SecKeyRef object for signing and verificaiton, you can direclt go for <a href="https://developer.apple.com/documentation/security/1393853-seckeycreatefromdata">SecKeyCreateFromData(_:_:_:)</a> which takes raw NSData from public key, but it is always fail. So we take the <a href="https://developer.apple.com/documentation/security/1396073-seccertificatecreatewithdata">SecCertificateCreateWithData(_:_:)</a>, which takes raw NSData from the SSL cert we created. Go for the cert is way easier.</p><p>With the following two functions, getPublicKeyFromCertificate, we pass the public key, ec_public_key.der, getPrivateKeyReferenceFromData, we pass the private key, ec_private_key.p12</p><p>With functions to do signing and verification</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/be3f226e3b683abd963fc270381267b5/href">https://medium.com/media/be3f226e3b683abd963fc270381267b5/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b971d13f1b6383405035b7a4fc383697/href">https://medium.com/media/b971d13f1b6383405035b7a4fc383697/href</a></iframe><p>and the signing and verification function</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/611d276331eaede6fb8400c5024029d0/href">https://medium.com/media/611d276331eaede6fb8400c5024029d0/href</a></iframe><p>Another case, which is the normal case that you DON’T have the private key, and you just got the signature and public key.</p><p>You need the public key from the ec_cert.crt, with the following function</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1aa161ca2dae4e45d5e0b7cba7eb287d/href">https://medium.com/media/1aa161ca2dae4e45d5e0b7cba7eb287d/href</a></iframe><p>And then you can input the base64 string from the ecCert.crt<br>if you open it by cat or textEditor, you will see things like</p><blockquote>— — -BEGIN CERTIFICATE — — -</blockquote><blockquote>MIIXXXXXXXXXXXXXXXXXXXX…..</blockquote><blockquote>— — -END CERTIFICATE — — -</blockquote><p>which this base64 string can be converted to NSData and pass to the above — (SecKeyRef)getPublicKeyFromCertificate:(NSData *)data to get the public key</p><p>NSString *b64Cert = @”MIxxxxxxxxxxx”;<br>NSData *b64CertData= [[NSData alloc] initWithBase64EncodedString:b64Cert options:NSDataBase64DecodingIgnoreUnknownCharacters];<br>SecKeyRef publicKey = [self getPublicKeyFromCertificate:b64CertData];</p><p>Done! So, no matter you are given the key files(.der for public, .p12 for private), or just a base64 string from a SSL certificate, you can now verify the Elliptic Curve signed signature.</p><p>At the end, i would like to have some explanation on the key files we created.</p><p>The cert we created(ecCert.crt) is a SSL cert, which you install in your server, and means that your server can be trusted, the browser will then instantiate a https connection. More info at</p><p><a href="https://www.digicert.com/ssl/">What Is SSL (Secure Sockets Layer)? | DigiCert.com</a></p><p>You can see that there are different format of keys, .der, .pem, .p12 If you open them in textEditor, or with cat. You can see that both .der and .p12 are encoded while .pem is in base64 string.</p><p>For the SSL certificates, it has to be in x509 format, which the format is in ASN.1 data structure.</p><blockquote>.der means DER encoded certificate</blockquote><blockquote>.p12 means PKCS #12, which format the key under Public Key Cryptography Standard #12</blockquote><blockquote>.pem which is a base64 encoded .der file</blockquote><p>Just bear in mind, the most convenient way for getting a SecKeyRef object in iOS will be having a .der file for public key, .p12 file for private key.</p><p>For Java, it is the .pem for both public and private key.</p><p>References:</p><ul><li><a href="https://serverfault.com/questions/9708/what-is-a-pem-file-and-how-does-it-differ-from-other-openssl-generated-key-file">What is a Pem file and how does it differ from other OpenSSL Generated Key File Formats?</a></li><li><a href="https://cryptologie.net/article/262/what-are-x509-certificates-rfc-asn1-der">What are x509 certificates? RFC? ASN.1? DER?</a></li></ul><p>Playing with Swift Digital Signature Signing and Verfication</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aff4c0a7f805" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[3 mins Swift]]></title>
            <link>https://medium.com/@edisonlo/3-mins-swift-4a92cb8c3941?source=rss-588c94c86fc8------2</link>
            <guid isPermaLink="false">https://medium.com/p/4a92cb8c3941</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[apps]]></category>
            <dc:creator><![CDATA[Edison Lo]]></dc:creator>
            <pubDate>Tue, 03 Oct 2017 07:21:06 GMT</pubDate>
            <atom:updated>2017-10-03T07:22:10.047Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi, this is Edison from Hong Kong, a year 3 student of Computer Science in HKU. Right now, i am doing my one year placement, and part of my job duty is to maintain and develop about iOS application. I would like to take this chance to start a blog with some articles about Swift. The direction of my posts about swift will be the topics i found time-consuming to understand and i hope i can explain it in a precise manner which take most of you 3 mins to read.</p><p>Some background information about myself,<br>iOS developing exeprience : 1.5<br>Projects: <br>1. MaMaria <a href="https://itunes.apple.com/hk/app/mamaria%E5%AA%BD%E5%AA%BD%E5%A5%BD%E5%B9%AB%E6%89%8B/id1062236630?l=zh&amp;mt=8">https://itunes.apple.com/hk/app/mamaria%E5%AA%BD%E5%AA%BD%E5%A5%BD%E5%B9%AB%E6%89%8B/id1062236630?l=zh&amp;mt=8</a><br>2. WL Rapport<br><a href="https://itunes.apple.com/hk/app/wl-rapport/id1231614155?l=zh&amp;mt=8">https://itunes.apple.com/hk/app/wl-rapport/id1231614155?l=zh&amp;mt=8</a></p><p>Hobbies: Field Hockey, Soccer, Piano<br>Contact at Email: edisonlolhn@gmail.com</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a92cb8c3941" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>