Bookmark and Share
RSS

Recent Posts

Decoding iCalendar Files

January 31, 2017

If you use an electronic calendar, chances are you're dealing with multiple calendaring and email systems between your work and personal accounts. Some folks use Google Calendar, others use Outlook and still others use Lotus Notes for example. Personally, I use multiple email clients, and each one has a calendar. I prefer to keep all of my appointments in one place using one piece of software, and everything has to sync with my phone.  

Many calendar meeting invitations, regardless of the platform, get sent back and forth as iCalendar (.ics) files:

iCalendar is a computer file format which allows Internet users to send meeting requests and tasks to other Internet users by sharing or sending files in this format through various methods. The files usually have an extension of .ics. With supporting software, such as an email reader or calendar application, recipients of an iCalendar data file can respond to the sender easily or counter-propose another meeting date/time. The file format is specified in a proposed internet standard (RFC 5545) for calendar data exchange.

iCalendar is used and supported by a large number of products, including Google Calendar, Apple Calendar (formerly iCal), IBM Lotus Notes, Yahoo! Calendar, Evolution (software), eM Client, Lightning extension for Mozilla Thunderbird and SeaMonkey, and partially by Microsoft Outlook and Novell GroupWise.
 

One thing I've noticed is that when I get sent an .ics file or calendar invite in Gmail, Google makes it difficult to transfer that file to another mail reader -- it tries really hard to force you to use Google Calendar. You can't simply forward that invite from Gmail to another mail program and expect it to just work. Fortunately, there is a way to deal with this. Select Show Original to view the original email, and then scroll to the bottom, where there's a section with this header:

    Content-Type: text/calendar; charset="utf-8"; method=REQUEST
    Content-Transfer-Encoding: base64

Google seems to intentionally encode the .ics file (shocking, I know), so you need a way to make it readable. There are tools that work fine in most instances (just search on "base64 decode"). Basically, you'd cut and paste the information and get a valid .ics file. But if you're dealing with important, work-related documents, keep in mind that this decoding can also be done from your command line.

For instance, here's how to work with .isc files in Linux:

    $ echo -n 'scottlinux.com rocks' | base64
    c2NvdHRsaW51eC5jb20gcm9ja3MK

    $ echo -n c2NvdHRsaW51eC5jb20gcm9ja3MK | base64 -d
    scottlinux.com rocks

On AIX, you can use openssl:

openssl base64 -e <<< 'Welcome to openssl wiki'
V2VsY29tZSB0byBvcGVuc3NsIHdpa2kK
openssl base64 -d <<< 'V2VsY29tZSB0byBvcGVuc3NsIHdpa2kK'
Welcome to openssl wiki

warning base64 line length is limited to 76 characters by default in openssl ( and generated with 64 characters / line ).

openssl base64 -e <<< 'Welcome to openssl wiki with a very long line that splits...'
V2VsY29tZSB0byBvcGVuc3NsIHdpa2kgd2l0aCBhIHZlcnkgbG9uZyBsaW5lIHRo
YXQgc3BsaXRzLi4uCg==

openssl base64 -d <<< 'V2VsY29tZSB0byBvcGVuc3NsIHdpa2kgd2l0aCBhIHZlcnkgbG9uZyBsaW5lIHRoYXQgc3BsaXRzLi4uCg=='
=> NOTHING !

to be able to decode a base64 line without line feed that exceed 76 characters use -A option :
openssl base64 -d -A <<< 'V2VsY29tZSB0byBvcGVuc3NsIHdpa2kgd2l0aCBhIHZlcnkgbG9uZyBsaW5lIHRoYXQgc3BsaXRzLi4uCg=='

Welcome to openssl wiki with a very long line that splits...
 

In any event, plenty of available options make it simple enough to decode the text. Once the text is deobfuscated, save it as an .ics file. You should then be able to open the .ics file with your mail client of choice and successfully add it to your calendar.

Posted January 31, 2017 | Permalink

Post a Comment

Note: Comments are moderated and will not appear until approved

comments powered by Disqus