<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Not Really A Blog</title>
	<atom:link href="http://sigmaris.info/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://sigmaris.info/blog</link>
	<description>...</description>
	<lastBuildDate>Wed, 06 Jul 2011 10:32:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Two-factor authentication with Mac OS X and OpenSC part 2</title>
		<link>http://sigmaris.info/blog/?p=126</link>
		<comments>http://sigmaris.info/blog/?p=126#comments</comments>
		<pubDate>Sun, 20 Feb 2011 23:11:50 +0000</pubDate>
		<dc:creator>sigmaris</dc:creator>
				<category><![CDATA[mac]]></category>
		<category><![CDATA[smartcard]]></category>
		<category><![CDATA[encryption]]></category>
		<category><![CDATA[opensc]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://sigmaris.info/blog/?p=126</guid>
		<description><![CDATA[This is the second part of the guide to smartcard-based authentication on Mac OS X. In this part of the guide, I&#8217;m going to assume that following Part 1, you have installed OpenSC, initialised your smartcard, and loaded or generated some certificates and private keys onto it. Now I&#8217;m going to show you how to [...]]]></description>
			<content:encoded><![CDATA[<p>This is the second part of the guide to smartcard-based authentication on Mac OS X. In this part of the guide, I&#8217;m going to assume that following Part 1, you have installed OpenSC, initialised your smartcard, and loaded or generated some certificates and private keys onto it. Now I&#8217;m going to show you how to use the card for actual authentication.</p>
<p><span id="more-126"></span></p>
<h3>Smartcard as Keychain</h3>
<p>The first step is to get it working with Mac OS X is to check that it shows up as a Keychain with the certificates you loaded on it. Open /Applications/Utilities/Keychain Access.app and look in the list of keychains at the top left. There should be an entry for your smartcard &#8211; if you didn&#8217;t give the smartcard a label when initialising it, the keychain will be named &#8216;OpenSC Card &#8230;&#8217;. If you click on the keychain in the list, you should see the contents include any certificates and keys that you loaded on the card. Make sure that any certificates that identify you, with associated private keys on the card, show up in the &#8216;My Certificates&#8217; category.</p>
<p>If the card doesn&#8217;t show up as a keychain, it means the OpenSC Tokend (the software component which communicates with the card on behalf of OS X) isn&#8217;t operating properly. Unfortunately the best way to debug this is to look at the log files in Console.app.</p>
<p>In the system.log file when the card reader is plugged in you should see the smart card reader (SmartcardCCID) start up:</p>
<pre>com.apple.securityd[44]: /SourceCache/SmartcardCCID/SmartcardCCID-35253/ccid/ccid/src/ifdhandler.c:1323:init_driver() Driver version: 1.3.8
pcscd[6663]: Non-smartcard device launched pcscd [Vendor: 0X54C, Product: 0X155]</pre>
<p>Then when the card is inserted into the reader (or immediately afterwards, if you are using a USB token with integrated card and reader), you should see messages similar to this in the secure.log file:</p>
<pre>com.apple.SecurityServer[44]: Token reader ACS ACR 38U-CCID 00 00 inserted into system
com.apple.SecurityServer[44]: token inserted into reader ACS ACR 38U-CCID 00 00
com.apple.SecurityServer[44]: reader ACS ACR 38U-CCID 00 00 inserted token “OpenSC Card” (OpenSC3090241616010310) subservice 2 using driver com.apple.tokend.opensc</pre>
<p>This shows that a ‘token’ (i.e. a smartcard) was inserted into the card reader, and it was recognised by the OpenSC Tokend.</p>
<h3>Login Authentication</h3>
<p>To get Mac OS X to use this smartcard to authenticate you, it must have a certificate and accompanying private key already loaded onto it (see <a title="Two-factor authentication with Mac OS X and OpenSC, part 1" href="/blog/?p=97">part 1</a>). Now we must add an attribute to your user record in OS X containing the public key hash of the certificate. OS X will notice if a smartcard with the associated certificate and private key is inserted, and allow you to log in.</p>
<p>Adding the attribute can be done with a command-line tool named <code>sc_auth</code>. Insert the smartcard with the certificate you want to use, open up a terminal, and type in:</p>
<pre>sc_auth hash</pre>
<p>This should list the public key hashes and names of any identity certificates found in all your keychains, giving output similar to this:</p>
<pre>DD5D693D420A9FEFDA979950142F8B592C869139 OpenSC Card (User PIN):Your Network ID Certificate
9A63B1932497A1D95967857FACD4A4B19A7C5226 com.apple.systemdefault
CCD99DBE1CE0D3962CA4D329BB5943EB83C78E68 localhost
BC944D344B2323615597B89DF836FEBF0177053C com.apple.kerberos.kdc</pre>
<p>Ignore the com.apple&#8230; and localhost entries for now. The hash we want is the top one which relates to the certificate on your smartcard. It might also just be called ‘Private Key’. Copy your 40-character hash string from this row (the hexadecimal part before “OpenSC Card&#8230;&#8221;), and paste it into the following command:</p>
<pre>sudo sc_auth accept -u username -h DD5D693D420A9FEFDA979950142F8B592C869139</pre>
<p>Substitute your username for ‘username’ and your certificate hash value for the one above. sudo will ask for your password, then sc_auth will add an attribute to your user record identifying the certificate as one that is accepted for logging you in.</p>
<p>To test it, remove the smartcard, and log out. At the login window, insert the smartcard and wait a few seconds. The normal login window with a password box should change to showing a PIN prompt. Type in the smartcard’s PIN, and it should authenticate you using the associated private key on the smartcard, and log you in. You should also be able to authenticate yourself by typing in the PIN when performing an option that requires privileges (e.g. unlocking the padlock icon in System Preferences).</p>
<h3>Digitally Signing and Encrypting Email</h3>
<p>If you have the OpenSC tokend working, and a valid email signing certificate on your smartcard, Mail.app should be able to digitally sign and encrypt email, using the <a title="Wikipedia page for S/MIME" href="http://en.wikipedia.org/wiki/S/MIME" target="_blank">S/MIME</a> standard, without any extra configuration. There are a few things to note, though:</p>
<ul>
<li>You need a valid (non-expired) certificate on the smartcard, with your email address in the emailAddress field.</li>
<li>The email address on the cert must match your address as set up in your account in Mail.app (case sensitive).</li>
<li>If you start Mail.app with no smartcard inserted, you may need to restart it to get the <a title="Sending signed and encrypted messages" href="http://docs.info.apple.com/article.html?path=Mail/4.0/en/10009.html" target="_blank">signing and encryption options</a> to appear.</li>
<li>Your email signing certificate must be issued by a widely trusted CA (e.g. Thawte, Verisign, Comodo, etc) for it to show as ‘trusted’ in other people’s mail clients.</li>
<li>To encrypt an email to someone, you must have their email certificate, as well as having you own. You can digitally sign emails to anyone, though. The easiest way to get someone else’s email certificate is to get them to send you a signed email.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://sigmaris.info/blog/?feed=rss2&#038;p=126</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Two-factor authentication with Mac OS X and OpenSC part 1</title>
		<link>http://sigmaris.info/blog/?p=97</link>
		<comments>http://sigmaris.info/blog/?p=97#comments</comments>
		<pubDate>Sat, 13 Nov 2010 22:59:27 +0000</pubDate>
		<dc:creator>sigmaris</dc:creator>
				<category><![CDATA[mac]]></category>
		<category><![CDATA[smartcard]]></category>
		<category><![CDATA[encryption]]></category>
		<category><![CDATA[opensc]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://sigmaris.info/blog/?p=97</guid>
		<description><![CDATA[Interested in using a smartcard for secure two-factor authentication on OS X? What about E-mail signing and encryption, SSH key authentication, and more? All of these applications are possible, using the built-in smartcard support in OS X and open source software. What follows is the first part of a guide to using smartcards on OS [...]]]></description>
			<content:encoded><![CDATA[<p>Interested in using a smartcard for secure two-factor authentication on OS X? What about E-mail signing and encryption, SSH key authentication, and more? All of these applications are possible, using the built-in smartcard support in OS X and open source software. What follows is the first part of a guide to using smartcards on OS X, using software from the <a title="OpenSC Project" href="http://www.opensc-project.org/" target="_blank">OpenSC Project</a>.</p>
<p><span id="more-97"></span>You&#8217;ll need:</p>
<ul>
<li>The <a title="OpenSC Mac Installer" href="http://www.opensc-project.org/opensc/wiki/MacInstaller" target="_blank">Mac Installer Package</a> from OpenSC</li>
<li>A blank smartcard supported by OpenSC (see <a title="List of OpenSC supported hardware" href="http://www.opensc-project.org/opensc/wiki/SupportedHardware" target="_blank">list</a>)</li>
<li>A card reader with Mac OS X support (The best choice is a CCID compliant USB device, see <a title="CCID supported readers list" href="http://pcsclite.alioth.debian.org/section.html" target="_blank">list</a>)</li>
</ul>
<p style="text-align: justify;">I&#8217;m using a Feitian PKI card from <a title="gooze.eu website" href="http://www.gooze.eu/" target="_blank">gooze.eu</a> which is supported by the entersafe driver in OpenSC. Other good choices are the <a title="Aventra MyEID details" href="http://www.opensc-project.org/opensc/wiki/MyEID" target="_blank">Aventra MyEID</a> card, or a blank JavaCard which can be loaded with the <a title="MuscleCard applet" href="http://www.opensc-project.org/opensc/wiki/MuscleApplet" target="_blank">MUSCLE applet</a>. Please note that I&#8217;ve only tested this with the Feitian PKI card and an ACR-38U CCID compatible reader &#8211; YMMV with other combinations of cards and readers! The <a title="OpenSC project Wiki" href="http://www.opensc-project.org/opensc" target="_blank">OpenSC Wiki</a> provides useful information on initialising many different types of cards.</p>
<h3>Install OpenSC</h3>
<p>Download the Mac Installer package mentioned above, and install the package contained within. This will install OpenSC to /Library/OpenSC, and also install a few other components which integrate OpenSC with Mac OS X. The most important of these is the Tokend (Token Daemon), a component which integrates your smartcard with the Keychain framework in OS X.</p>
<h3>Testing OpenSC</h3>
<p style="text-align: justify;">Open a Terminal window. Plug the card reader into your Mac, and enter the command</p>
<pre>opensc-tool --list-readers</pre>
<p style="text-align: justify;">You should see your card reader shown in the list, like this:</p>
<pre>Readers known about:
Nr.    Driver     Name
0      pcsc       CASTLES EZ100PU 00 00</pre>
<p style="text-align: justify;">Then, insert your blank smartcard into the reader, and enter the command (assuming you are using reader 0):</p>
<pre>opensc-tool --reader 0 --atr</pre>
<p style="text-align: justify;">You should see a string of hex digits which identifies your card. Now, check that OpenSC recognises the card and can match it to a driver:</p>
<pre>opensc-tool --reader 0 --name</pre>
<p style="text-align: justify;">should print a human-readable name for the card. For my Feitian PKI card it just prints &#8220;entersafe&#8221;.</p>
<h3>Initialising the PKCS#15 structure</h3>
<p style="text-align: justify;">If all these tests succeed, you can proceed to initialising the PKCS#15 structure on the card. For this we use the pkcs15-init command from OpenSC:</p>
<pre>pkcs15-init -CT -p pkcs15+onepin --no-so-pin --pin yourpin --puk yourpuk --label "YourName"</pre>
<p style="text-align: justify;">The options here are:</p>
<ul>
<li>-C creates the PKCS#15 files.</li>
<li>-T uses the default Transport Key (a key needed to access the card).</li>
<li>-p pkcs15+onepin sets the card to use a single PIN for all operations.</li>
<li>&#8212;no-so-pin tells the command we don&#8217;t want a Security Officer PIN.</li>
<li>&#8212;pin yourpin specifies the PIN. Replace yourpin with whatever you want to use.</li>
<li>&#8212;puk yourpuk specifies the PUK (Unblock code). Replace yourpuk with whatever you want to use.</li>
<li>&#8212;label &#8220;YourName&#8221; gives the card a name which it&#8217;ll be displayed under in the Keychain and other applications.</li>
</ul>
<p style="text-align: justify;">We are only using one PIN here as the card will just be for personal use. We also don&#8217;t define a Security Officer PIN. The S.O. PIN is like an administrator password &#8211; it is used to protect the meta-data on the card including the PKCS#15 structure, in a situation where the person provisioning and issuing the card is not the same as the card&#8217;s end-user.</p>
<p style="text-align: justify;">The PUK (Pin Unlock Key) is used to unblock the card if you have locked it due to too many incorrect PIN attempts. Make sure to define one as secure as possible and keep it safe in case you ever forget the PIN.  To check that the command ran successfully, we can list the contents of the PKCS#15 structure on the card. This is done with the command:</p>
<pre>pkcs15-tool --dump</pre>
<p style="text-align: justify;">This should show output something like this:</p>
<pre>Using reader with a card: CASTLES EZ100PU 00 00
PKCS#15 Card [OpenSC Card]:
Version        : 1
Serial number  : 0143540243543568
Manufacturer ID: EnterSafe
Last update    : 20100423143625Z
Flags          : EID compliant

PIN [User PIN]
Com. Flags: 0x3
ID        : 01
Flags     : [0x30], initialized, needs-padding
Length    : min_len:4, max_len:16, stored_len:16
Pad char  : 0x00
Reference : 1
Type      : ascii-numeric
Path      : 3f005015</pre>
<p style="text-align: justify;">You can see that one PIN has been created, with an ID of 01.</p>
<h3>Adding keys</h3>
<p style="text-align: justify;">To actually use the card for authentication, there must exist keys for encryption and digital signature on the card. Pairs of RSA public/private keys are the most commonly used form. Both the private and public keys are generated or loaded onto the card. The public key may be read from the card, but the private key may not be read &#8211; it stays on the card. The private key can only be used to encrypt / sign data by sending the card the PIN and the data to be signed. By this mechanism, it is ensured that only the person holding the card, and knowing the PIN, can make use of the private key.</p>
<h4>Option 1 &#8211; Generate a key pair on the card</h4>
<p style="text-align: justify;">This is one of the most secure options, as the private key is generated on the card and never leaves it. To generate a 2048bit RSA key pair, use the command:</p>
<pre>pkcs15-init -G rsa/2048 -a 01 -u sign,decrypt</pre>
<p style="text-align: justify;">The options used here are:</p>
<ul>
<li>-G rsa/2048 to generate a 2048-bit RSA keypair.</li>
<li>-a 01 to protect the key with auth ID 01 (the ID of the PIN you previously defined).</li>
<li>-u sign,decrypt to allow both signing and decryption with the key.</li>
</ul>
<p style="text-align: justify;">A 2048-bit key is recommended, however some cards may only support 1024 bit keys. You may be asked for your PIN several times during the process, which could take some time. Once it is over, the output of pkcs15-tool &#8211;dump should show a &#8220;Private RSA Key&#8221; and &#8220;Public RSA Key&#8221;.</p>
<p style="text-align: justify;">To make use of the key with Mac OS X, it needs to be associated with a X.509 certificate stored on the card. The certificate must be signed with the private key on the card. To accomplish this, we will use OpenSSL with the engine_pkcs11 component from OpenSC to generate a self-signed certificate.</p>
<p style="text-align: justify;">First, start OpenSSL:</p>
<pre>$ openssl
OpenSSL&gt;</pre>
<p style="text-align: justify;">Now, load the PKCS#11 engine, with the correct PKCS#11 module from OpenSC:</p>
<pre>OpenSSL&gt; engine dynamic -pre SO_PATH:/Library/OpenSC/lib/engines/engine_pkcs11.so \
-pre ID:pkcs11 -pre LIST_ADD:1 -pre LOAD -pre MODULE_PATH:/Library/OpenSC/lib/pkcs11/onepin-opensc-pkcs11.so
(dynamic) Dynamic engine loading support
[Success]: SO_PATH:/Library/OpenSC/lib/engines/engine_pkcs11.so
[Success]: ID:pkcs11
[Success]: LIST_ADD:1
[Success]: LOAD
[Success]: MODULE_PATH:/Library/OpenSC/lib/pkcs11/onepin-opensc-pkcs11.so
Loaded: (pkcs11) pkcs11 engine</pre>
<p style="text-align: justify;">Now the engine is loaded, tell OpenSSL to generate a self-signed certificate:</p>
<pre>OpenSSL&gt; req -engine pkcs11 -new -key id_45 -keyform engine -x509 -out cert.pem -text -days 365</pre>
<p style="text-align: justify;">This requests a self-signed certificate, with the private key id_45 (If the private key you generated has a different ID number, shown in pkcs15-tool &#8211;dump, use that instead of 45). We also ask for a validity period of 365 days (1 year). You will be asked for the smartcard&#8217;s PIN, then some information to put in the certificate such as your locality, name and e-mail address. This information can be left blank if you wish. After entering this information, the certificate will be written to the file cert.pem.</p>
<p style="text-align: justify;">Finally, load the certificate onto the card with the command</p>
<pre>pkcs15-init -X cert.pem --auth-id 01 --id 45 --format pem</pre>
<p style="text-align: justify;">After this is done, the output of pkcs15-tool &#8211;dump should show both the private and public keys, and an X.509 certificate, all with the same ID.</p>
<h4>Option 2 &#8211; Load a certificate and private key onto the card</h4>
<p style="text-align: justify;">This can be more useful if you already have a certificate from a CA, for example the free e-mail signing certs that are issued by <a title="InstantSSL free e-mail certificate" href="http://www.instantssl.com/ssl-certificate-products/free-email-certificate.html" target="_blank">instantssl.com</a>, or a certificate issued by your organization. Assuming your certificate and key are packaged in a PKCS#12 format file, use the following command to import them onto the card:</p>
<pre>pkcs15-init -S cert.p12 --format PKCS12 --auth-id 01</pre>
<p>This will store the cert and private key on the card and associate them together.</p>
<h4>Option 3 &#8211; Use the PKCS#11 plugin in Firefox to get a certificate from a CA</h4>
<p style="text-align: justify;">This method generates the key pair on the card, like option 1, for added security. It then uses the keys to make a certificate signing request with a CA, and when the CA sends back the signed certificate, it installs the certificate on the card. It will only work if the CA uses a web-based issuing process, using the &lt;keygen&gt; element to generate the key in the browser and submit a signing request.</p>
<p style="text-align: justify;">First you need to add the OpenSC PKCS#11 plugin to Firefox. PKCS#11 is a standard for plugins which communicate with security devices and can use the devices to perform encryption-related operations. Firefox can make use of devices with PKCS#11-compatible plugins, and luckily OpenSC provides such a plugin which will work with all types of card supported by OpenSC.</p>
<p style="text-align: justify;">Open the Firefox Preferences, and in the Advanced tab select Encryption. Click &#8220;Security Devices&#8221; and you should see the following window:</p>
<p style="text-align: center;"><a href="http://sigmaris.info/blog/wp-content/uploads/2010/11/ffx_securitydevs.png"><img class="size-medium wp-image-113 aligncenter" title="Firefox Security Devices" src="http://sigmaris.info/blog/wp-content/uploads/2010/11/ffx_securitydevs-300x208.png" alt="Firefox Security Devices" width="300" height="208" /></a></p>
<p style="text-align: justify;">Click &#8220;Load&#8221; and enter &#8220;OpenSC&#8221; for the module name. Click Browse for the module filename, and choose:</p>
<pre>/Library/OpenSC/lib/onepin-opensc-pkcs11.so</pre>
<p style="text-align: justify;">for the path. Click OK and you should see a new OpenSC module in the list, with some slots under it. If your reader and card are plugged in, one of the slots should display your card. If it shows up, you know that PKCS#11 is working OK.</p>
<p style="text-align: justify;">Now click OK on the Device Manager window, and close the Preferences window. Go to the CA&#8217;s site (for example <a title="InstantSSL" href="http://www.instantssl.com/ssl-certificate-products/free-email-certificate.html" target="_blank">InstantSSL / Comodo</a>) and follow their procedures to get a certificate. The CA will first ask your browser to generate a key, at this point Firefox should ask if you want to generate the key using your PKCS#11 device. Select your card and generate the key (you will be prompted for your PIN). The CA will then give you more steps to follow to collect the signed certificate &#8211; normally they will send you a link by e-mail after generating it. Visit the link to collect the certificate  using Firefox, with your card and reader plugged in, and Firefox should detect that the certificate is associated with your key on the smartcard, and offer to also install it on the card.</p>
<p style="text-align: justify;">After installing the certificate, it should show up in the &#8220;View Certificates&#8221; window in the Advanced Encryption preferences in Firefox.</p>
<h3>Using the keys and certificates</h3>
<p>The guide so far has shown how to install OpenSC and initialise your smartcard, but how do you use the card once all this is done? That will be the subject of the second part of this guide, which will be posted soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://sigmaris.info/blog/?feed=rss2&#038;p=97</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A Service for unmounting volumes in OS X</title>
		<link>http://sigmaris.info/blog/?p=91</link>
		<comments>http://sigmaris.info/blog/?p=91#comments</comments>
		<pubDate>Mon, 05 Apr 2010 00:13:47 +0000</pubDate>
		<dc:creator>sigmaris</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://sigmaris.info/blog/?p=91</guid>
		<description><![CDATA[A little while ago I had a problem. My phone is a Sony Ericsson K800i, with 64MB of internal storage and a slot for Memory Stick expansion storage. I was using it as an MP3 player, and so had an 8GB memory stick in there to store MP3s. When I connected it to my Mac [...]]]></description>
			<content:encoded><![CDATA[<p>A little while ago I had a problem. My phone is a Sony Ericsson K800i, with 64MB of internal storage and a slot for Memory Stick expansion storage. I was using it as an MP3 player, and so had an 8GB memory stick in there to store MP3s.</p>
<p>When I connected it to my Mac in USB drive mode to transfer files, it appeared in the Finder as two storage devices, one for the internal storage and one for the memory stick. When I&#8217;d finished transferring files I would click Eject on the memory stick&#8217;s device to safely remove it. Then I&#8217;d do the same on the internal storage&#8217;s device, but this would eventually fail and report an I/O error. The phone&#8217;s screen would show that the USB connection had ended, but one of the devices would still show in the Finder. If I then unplugged the USB cable the Finder would tell me that data might have been lost since I didn&#8217;t eject the storage device properly.</p>
<p>I eventually found a workaround &#8211; go into the Disk Utility app, and Unmount (not Eject) one device, then Eject the other. The order didn&#8217;t seem to matter, as the Eject would cause both devices to disappear. However this required me to launch Disk Utility to do the unmounting every time I had to unplug the phone from the Mac.</p>
<p>I started to get fed up of the extra time and clicking involved, so I decided to write a single-function Service to do the unmounting. Check it out <a href="?page_id=86">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://sigmaris.info/blog/?feed=rss2&#038;p=91</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Student Tech Meetup talk</title>
		<link>http://sigmaris.info/blog/?p=77</link>
		<comments>http://sigmaris.info/blog/?p=77#comments</comments>
		<pubDate>Thu, 18 Feb 2010 09:13:35 +0000</pubDate>
		<dc:creator>sigmaris</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[nds]]></category>
		<category><![CDATA[homebrew]]></category>
		<category><![CDATA[stmu]]></category>

		<guid isPermaLink="false">http://sigmaris.info/blog/?p=77</guid>
		<description><![CDATA[On Wednesday, I gave a talk at the Student Techmeetup here in Edinburgh on DS homebrew development. As promised, I&#8217;ve uploaded the slides from that talk as a PDF here, with links to a few tutorials and resources included in them, along with some notes.]]></description>
			<content:encoded><![CDATA[<p>On Wednesday, I gave a talk at the Student Techmeetup here in Edinburgh on DS homebrew development. As promised, I&#8217;ve uploaded the slides from that talk as a PDF <a title="DS Homebrew presentation" href="/files/dspreso.pdf" target="_blank">here</a>, with links to a few tutorials and resources included in them, along with some notes.</p>
]]></content:encoded>
			<wfw:commentRss>http://sigmaris.info/blog/?feed=rss2&#038;p=77</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>emitSMS plugin update</title>
		<link>http://sigmaris.info/blog/?p=71</link>
		<comments>http://sigmaris.info/blog/?p=71#comments</comments>
		<pubDate>Sat, 16 Jan 2010 15:10:00 +0000</pubDate>
		<dc:creator>sigmaris</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[address book]]></category>
		<category><![CDATA[bluetooth]]></category>
		<category><![CDATA[emitsms]]></category>

		<guid isPermaLink="false">http://sigmaris.info/blog/?p=71</guid>
		<description><![CDATA[The emitSMS plugin has been updated with a small new feature &#8211; it will now strip out dashes and spaces from your phone numbers in Address Book before sending them to the phone, as most phones don&#8217;t seem to accept numbers in this format. Grab the new version here.]]></description>
			<content:encoded><![CDATA[<p>The emitSMS plugin has been updated with a small new feature &#8211; it will now strip out dashes and spaces from your phone numbers in Address Book before sending them to the phone, as most phones don&#8217;t seem to accept numbers in this format. Grab the new version <a title="emitSMS Address Book Plugin" href="http://sigmaris.info/files/emitSMSAddressBookPlugin.bundle.zip">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://sigmaris.info/blog/?feed=rss2&#038;p=71</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>emitSMS plugin bug fix</title>
		<link>http://sigmaris.info/blog/?p=56</link>
		<comments>http://sigmaris.info/blog/?p=56#comments</comments>
		<pubDate>Sun, 25 Oct 2009 23:26:38 +0000</pubDate>
		<dc:creator>sigmaris</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">http://sigmaris.info/blog/?p=56</guid>
		<description><![CDATA[Here&#8217;s a new version of the Address Book plugin for SMS sending, with a small bug fix intended to stop it hanging after sending an SMS. If you&#8217;ve seen this problem with earlier versions, please let me know if this version has fixed it or not]]></description>
			<content:encoded><![CDATA[<p><a href="http://sigmaris.info/files/emitSMSAddressBookPlugin.bundle.zip">Here&#8217;s</a> a new version of the Address Book plugin for SMS sending, with a small bug fix intended to stop it hanging after sending an SMS. If you&#8217;ve seen this problem with earlier versions, please let me know if this version has fixed it or not <img src='http://sigmaris.info/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://sigmaris.info/blog/?feed=rss2&#038;p=56</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>emitSMS Address Book Plugin updated</title>
		<link>http://sigmaris.info/blog/?p=55</link>
		<comments>http://sigmaris.info/blog/?p=55#comments</comments>
		<pubDate>Thu, 01 Oct 2009 11:26:13 +0000</pubDate>
		<dc:creator>sigmaris</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[address book]]></category>
		<category><![CDATA[bluetooth]]></category>

		<guid isPermaLink="false">http://www.sigmaris.info/blog/?p=55</guid>
		<description><![CDATA[The emitSMS plugin for Address Book has been updated to use native Mac OS methods to access the phone over Bluetooth, rather than using an emulated serial port. This should make it less flaky when used under Snow Leopard. You can get the updated plugin here, and the new source code is here.]]></description>
			<content:encoded><![CDATA[<p>The emitSMS plugin for Address Book has been updated to use native Mac OS methods to access the phone over Bluetooth, rather than using an emulated serial port. This should make it less flaky when used under Snow Leopard. You can get the updated plugin <a title="emitSMS address book plugin" href="http://sigmaris.info/files/emitSMSAddressBookPlugin.bundle.zip">here</a>, and the new source code is <a title="emitSMS address book plugin source" href="https://github.com/sigmaris/AddressBookSMS" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://sigmaris.info/blog/?feed=rss2&#038;p=55</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>emitSMS plugin for Mac OS X Address Book.app</title>
		<link>http://sigmaris.info/blog/?p=43</link>
		<comments>http://sigmaris.info/blog/?p=43#comments</comments>
		<pubDate>Mon, 14 Sep 2009 16:16:27 +0000</pubDate>
		<dc:creator>sigmaris</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">http://www.sigmaris.info/blog/?p=43</guid>
		<description><![CDATA[In the distant past, the Address Book app in Mac OS X Tiger could send mobile SMS messages directly from within the app, if you paired your mobile phone with your Mac via Bluetooth. Along came Leopard, and the feature mysteriously vanished without trace or explanation, and hasn&#8217;t reappeared since. Missing the feature, I found [...]]]></description>
			<content:encoded><![CDATA[<p>In the distant past, the Address Book app in Mac OS X Tiger could send mobile SMS messages directly from within the app, if you paired your mobile phone with your Mac via Bluetooth. Along came Leopard, and the feature mysteriously vanished without trace or explanation, and hasn&#8217;t reappeared since. Missing the feature, I found a roundabout replacement in the <a title="emitSMS widget homepage" href="http://algoritmer.dk/widget/">emitSMS</a> dashboard widget. It offers SMS sending via Bluetooth and can also search the Address Book for phone numbers. Having seen that the <a title="emitSMS development page" href="http://algoritmer.dk/widget/develop.php">source code</a> for emitSMS was released, I adapted the backend into a plugin for Address Book.app to provide the missing former functionality.<span id="more-43"></span></p>
<p><a title="emitSMS Address Book plugin binary" href="/files/emitSMSAddressBookPlugin.bundle.zip">Download</a>, unzip and place the plugin in /Library/Address Book Plug-Ins/ and restart Address Book. You should then be able to click on a phone number on a person&#8217;s card and select &#8220;Send SMS via Bluetooth&#8221; to send them a SMS.</p>
<p><a href="/blog/wp-content/uploads/2009/09/Screen-shot-2009-09-14-at-16.05.47.png"><img class="aligncenter size-medium wp-image-44" title="Screen shot of emitSMS Address Book plugin" src="/blog/wp-content/uploads/2009/09/Screen-shot-2009-09-14-at-16.05.47-300x226.png" alt="Screen shot of emitSMS Address Book plugin" width="300" height="226" /></a>The <a title="emitSMS Address Book plugin source code" href="https://github.com/sigmaris/AddressBookSMS" target="_blank">source code</a> is also available, under the same MIT license as the original emitSMS source code.</p>
<h3>Notes</h3>
<p>The plugin should be compatible with Address Book in Leopard and Snow Leopard.</p>
<p><span style="text-decoration: line-through;">To use the plugin (or the emitSMS widget, in fact) you need to set up a virtual serial port over Bluetooth to your phone. This will normally be set up automatically by OS X when you pair your phone with your Mac, but the serial ports can be edited in the Bluetooth panel in System Preferences if necessary.</span> (edit: No longer necessary in the latest version, all you need to do is pair your phone with your Mac).</p>
<p>After you select a port to use in the pop-up menu, it will test the port for SMS sending capabilities. The port will only be usable if the test succeeds. Some phones seem to be a little flaky when communicating via Bluetooth and require the test to be run a few times before it can establish a connection successfully. If it fails initially, try clicking on the port again.</p>
<p>If &#8216;Long Messages&#8217; is not enabled your messages will be limited to 160 characters (or 70 characters if you use symbols outside the standard GSM set, e.g. ^ ). Not all phones support the sending of long messages (actually splitting the message into several SMSs). Additionally, not all phones support requesting delivery receipts.</p>
<p>In general, if your phone works with the emitSMS dashboard widget, it should work with this plugin as the same underlying method is used to send the SMSs.</p>
]]></content:encoded>
			<wfw:commentRss>http://sigmaris.info/blog/?feed=rss2&#038;p=43</wfw:commentRss>
		<slash:comments>91</slash:comments>
		</item>
		<item>
		<title>Deflektor remake for Nintendo DS</title>
		<link>http://sigmaris.info/blog/?p=19</link>
		<comments>http://sigmaris.info/blog/?p=19#comments</comments>
		<pubDate>Sun, 07 Jun 2009 23:32:03 +0000</pubDate>
		<dc:creator>sigmaris</dc:creator>
				<category><![CDATA[nds]]></category>

		<guid isPermaLink="false">http://www.sigmaris.info/blog/?p=19</guid>
		<description><![CDATA[Here is a project I&#8217;ve been working on for a few weeks to learn more about DS homebrew coding. It&#8217;s a remake of Deflektor, an old puzzle game that I played on the Amiga. I&#8217;ve tried to keep the retro feel of the original while updating it to use the touchscreen interface. The aim is [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a project I&#8217;ve been working on for a few weeks to learn more about DS homebrew coding. It&#8217;s a remake of Deflektor, an old puzzle game that I played on the Amiga. I&#8217;ve tried to keep the retro feel of the original while updating it to use the touchscreen interface.</p>
<p><img class="alignnone size-full wp-image-37" title="ss2" src="http://sigmaris.info/blog/wp-content/uploads/2009/06/ss2.png" alt="ss2" width="186" height="278" /><img class="alignnone size-full wp-image-36" title="ss1" src="http://sigmaris.info/blog/wp-content/uploads/2009/06/ss1.png" alt="ss1" width="185" height="278" /></p>
<p>The aim is to rotate the mirrors (<img class="alignnone size-full wp-image-24" title="mirror" src="http://sigmaris.info/blog/wp-content/uploads/2009/06/mirror.png" alt="mirror" width="16" height="16" />) to reflect the laser beam from the source (<img class="alignnone size-full wp-image-26" title="source" src="http://sigmaris.info/blog/wp-content/uploads/2009/06/source.png" alt="source" width="16" height="16" />) to blow up all the triggers (<img class="alignnone size-full wp-image-30" title="trigger" src="http://sigmaris.info/blog/wp-content/uploads/2009/06/trigger.png" alt="trigger" width="16" height="14" />) and then enter the target (<img class="alignnone size-full wp-image-28" title="target" src="http://sigmaris.info/blog/wp-content/uploads/2009/06/target.png" alt="target" width="16" height="16" />). Rotate the mirrors by tapping on them and then dragging to align the mirror at a particular angle. You start with an amount of energy which is constantly declining (the green bar). Directing the beam into a spike (<img class="alignnone size-full wp-image-27" title="spike" src="http://sigmaris.info/blog/wp-content/uploads/2009/06/spike.png" alt="spike" width="16" height="13" />) or reflecting the beam back to the source will cause it to overload (represented by the red bar). If the source is overloaded too much or if you run out of energy, you lose a life. There are also rotating blocks which only allow the beam to pass at a certain angle (<img class="alignnone size-full wp-image-23" title="angleblocker" src="http://sigmaris.info/blog/wp-content/uploads/2009/06/angleblocker.png" alt="angleblocker" width="16" height="16" />), teleports (<img class="alignnone size-full wp-image-29" title="teleport" src="http://sigmaris.info/blog/wp-content/uploads/2009/06/teleport.png" alt="teleport" width="16" height="16" />) which work in pairs, and blocks which randomize the beam direction (<img class="alignnone size-full wp-image-25" title="random" src="http://sigmaris.info/blog/wp-content/uploads/2009/06/random.png" alt="random" width="16" height="16" />). In addition, in some levels there are gremlins which roam about the board and mess with your stuff. You can get rid of them by tapping on them repeatedly.</p>
<p>There are a few things I&#8217;d like to add to the game, like highscore saving and a level editor, which might appear if I have time to work on it. For now it comes with all the levels from the original game. You can download it <a title="deflektor ds zip file" href="http://sigmaris.info/files/deflektor-ds.zip">here</a>. Any comments, bug reports, etc are welcome!</p>
]]></content:encoded>
			<wfw:commentRss>http://sigmaris.info/blog/?feed=rss2&#038;p=19</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>DesMuME for Mac OS X with GDB stub support</title>
		<link>http://sigmaris.info/blog/?p=10</link>
		<comments>http://sigmaris.info/blog/?p=10#comments</comments>
		<pubDate>Mon, 06 Apr 2009 04:00:11 +0000</pubDate>
		<dc:creator>sigmaris</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[nds]]></category>

		<guid isPermaLink="false">http://www.sigmaris.info/blog/?p=10</guid>
		<description><![CDATA[I&#8217;ve built a Mac (Intel) binary of DesMuME, from the latest SVN code, with a patch to enable masscat&#8217;s GDB stub. With it you can load a homebrew rom, connect to DesMuME with the copy of GDB that&#8217;s provided with devkitARM, and start debugging your homebrew code while it&#8217;s running in the emulator. For more [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve built a Mac (Intel) binary of DesMuME, from the latest SVN code, with a patch to enable masscat&#8217;s GDB stub. With it you can load a homebrew rom, connect to DesMuME with the copy of GDB that&#8217;s provided with devkitARM, and start debugging your homebrew code while it&#8217;s running in the emulator. For more details check out <a title="Desmume + GDB debugger stub" href="http://forums.desmume.org/viewtopic.php?id=85">this post</a> on the official forums.</p>
<p>The binary can be found <a title="DesMuMe Mac binary with GDB stub" href="/files/desmume-gdbstub-svn.zip">here</a>, and the modified parts of the source code can be downloaded <a title="DesMuMe Mac source patched to use GDB stub" href="/files/desmume-gdbstub-svn-src.zip">here</a>. Please let me know if you find any bugs related to using the GDB stub &#8211; I&#8217;ve tested it a bit and most features seem to work, but this is the first time I&#8217;ve worked on the DesMuME code and I may have overlooked something. I take no responsibility for bugs in the unmodified Mac version of DesMuME though <img src='http://sigmaris.info/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<h3>How to use it:</h3>
<p>Currently the only method of specifying the debugger ports to use is on the command line. So, open up Terminal.app and run DesMuME from there, like so:</p>
<pre>orange:~ sigmaris$ /path/to/DeSmuME.app/Contents/MacOS/DeSmuME -arm9gdb 20000</pre>
<p>Note the single dash before the argument. This will start the ARM9 stub listening on port 20000. You can also use -arm7gdb &lt;port&gt; to start the ARM7 stub. You can omit either of the arm9gdb or arm7gdb arguments and it won&#8217;t start the respective GDB stubs at all. If startup was successful you should see log messages like this on the console:</p>
<pre>2009-04-05 22:32:41.896 DeSmuME[29404:10b] Using ARM9 GDB port 20000</pre>
<p>Then go to the DesMuME window, set up a FAT image if necessary, and load your homebrew ROM. You&#8217;ll notice it doesn&#8217;t start immediately but just shows a white screen. It is waiting for GDB to connect, so go ahead and start it up (I assume you have devkitPRO installed in /usr/local)</p>
<pre>orange:~ sigmaris$ /usr/local/devkitPRO/devkitARM/bin/arm-eabi-gdb homebrew.elf</pre>
<p>You should point gdb to the compiled ELF file of the homebrew ROM that you loaded earlier. You should see the (gdb) prompt, now tell GDB to connect to the DesMuME stub:</p>
<pre>(gdb) target remote :20000
Remote debugging using :20000
0x02000000 in _start ()
(gdb)</pre>
<p>If you see the above output, you&#8217;re ready to start debugging. For example, set a breakpoint on a function that you use in your homebrew program, and then enter &#8216;cont&#8217; to tell DesMuME to continue running the program. You should see your program run up to the breakpoint and then stop, and GDB will print a message saying it encountered the breakpoint. You can now examine the state of local variables, print a backtrace, or step line-by-line through your code.</p>
<p>Hopefully this will be useful for some homebrew DS developers on the Mac. Unfortunately, even with the GDB stub in place, DesMuME doesn&#8217;t catch many of the errors that would trip you up on a real DS like writes to invalid memory and other similar errors. But being able to jump in anywhere and examine the running state of your code is a step forward from just using tons of iprintf() calls <img src='http://sigmaris.info/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://sigmaris.info/blog/?feed=rss2&#038;p=10</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

