Archive for December, 2009

timm

Adobe Connect: Toronto Seminar (Prov Gov't) – Feb 11, 2010

Monday, December 21st, 2009

New Toronto Group and Adobe Systems have partnered to provide Adobe Acrobat Connect Pro software. Rated number one for Web Conferencing in 2009 by TopTen Reviews, Connect Pro is a “must see” if your organization is evaluating eLearning and conferencing software tools. New Toronto Group is the Ontario Government Vendor of Record for Connect Pro.

Join New Toronto Group and Adobe for a live seminar showcasing how Adobe Acrobat Connect Pro can provide the ability to captivate audiences with interactive web meetings and virtual classroom experiences. This award winning package provides unique capabilities including:

  • Flash technology base – allows easy access to on line sessions.
  • Reduced network requirements – allows better interactivity.
  • Strong security – feel comfortable with sharing information.
  • Feature rich environment – based on established software base.
  • 7th generation solution – thousands of customers worldwide.

Learn how organizations like the Ontario Ministry of Health, the Ontario Ministry of Education and U.S. Dept. of Defence have rolled-out Adobe Connect Pro for their Web Conferencing and eLearning needs.

Date / Time: February 11, 8:30am – 11:00am

Location: Queen’s Park Conference Facilities, 77 Wellesley St., Huron Room

To register: http://ntg.mmalliance.acrobat.com/febops/event/registration.html
For more details, phone 866-464-7790 x.4041

Chad Upton

Encryption and Decryption with as3crypto Library

Thursday, December 17th, 2009

By: Chad Upton

The as3crypto library is packed with the most common encryption and decryption algorithms. In this post, I want to demonstrate how you can use the as3crypto library to encrypt and then decrypt some data that is useful in a variety of real world scenarios.

Encryption is the process used to turn plain text into unreadable information.  Decryption is the process of turning unreadable encrypted information back it into plain text.  Both operations require an encryption algorithm and key.  Anyone who has the key and algorithm can convert the encrypted information back into plain text.  This is useful when storing data or transferring data to a place where you don’t want anyone to read it.

There are half a dozen secret key encryption algorithms in as3crypto.  Some of these algorithms are better than others, and others are provided because they are common in legacy systems and may be needed for compatibility. I’m going to cover the various algorithms in a future post; for this post I’ll use AES since it is a fast and strong algorithm.

Let’s say you want to write data to an encrypted file.  Perhaps, you want to store application settings or software license info in a file, but you don’t want anyone to read it and possibly compromise your licensing system.

Follow the steps below to make an AIR app that will encrypt some data and write it to a file.

Figure 1
Figure 1
  1. Start by creating a new AIR project in Flex Builder
  2. Name the main application file Encrypt.mxml (Figure 1)
  3. Download the as3crypto library (swc file) from the project on google code
  4. Place as3crypto.swc in your AIR project’s libs folder (Figure 2)
  5. Copy the code below and replace everything in Encrypt.mxml with it
Figure 2
Figure 2
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication
xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal" width="340" height="150" showStatusBar="false" verticalAlign="middle">

<mx:Script>
<![CDATA[
import com.hurlant.crypto.symmetric.AESKey;
import mx.controls.Alert;
import com.hurlant.crypto.symmetric.DESKey;
import com.hurlant.util.Hex;
import mx.charts.CategoryAxis;

private static var stream:FileStream;
private static var file:File;

private function encrypt():void
{

file = File.desktopDirectory.resolvePath("encrypted.txt");

//open a filestream to write to file
stream = new FileStream();
stream.open( file, FileMode.WRITE );

//define the encryption key
var key:ByteArray        = Hex.toArray("NewTorontoGroup");

//put plaintext into a bytearray
var plainText:ByteArray    = Hex.toArray(Hex.fromString(txtInput.text));

//set the encryption key
var aes:AESKey            = new AESKey(key);

//encrypt the text
aes.encrypt( plainText );

//write encrpted text to the file
stream.writeMultiByte( Hex.fromArray(plainText), "utf-8" );

//provide confirmation
Alert.show("Text written to file on desktop","Success");

//close the stream
stream.close();

}

]]>
</mx:Script>

<mx:TextInput id="txtInput" text="Enter text to be encrypted." />

<mx:Button label="Create File" click="encrypt()" />

</mx:WindowedApplication>

Run the Encrypt app.  Type some text into the Text Input and click the Create File button. A file called “encrypted.txt” will be written to your desktop. Open the file and look at your text in its encrypted form.  If you don’t see anything, check your encrypt application.  Try copying the code and clicking the Create File button again. Now we’ll create an app to decrypt the file.

  1. Start by creating a new MXML Application
  2. Name the file Decrypt.mxml (Figure 3)
  3. Copy the code below and replace everything in Decrypt.mxml with it
Figure 3
Figure 3
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="init()" showStatusBar="false">

<mx:Script>
<![CDATA[
import com.hurlant.crypto.symmetric.AESKey;
import com.hurlant.crypto.symmetric.DESKey;
import com.hurlant.util.Hex;
import mx.managers.DragManager;

private function init():void{
addEventListener(NativeDragEvent.NATIVE_DRAG_ENTER, dragEnterHandler);
addEventListener(NativeDragEvent.NATIVE_DRAG_DROP, dragDropHandler);
}

private function dragEnterHandler( event:NativeDragEvent ):void
{

DragManager.acceptDragDrop(this);
}

private function dragDropHandler( event:NativeDragEvent ):void
{
//get the file
var file:File = File(event.clipboard.getData(ClipboardFormats.FILE_LIST_FORMAT)[0]);

//create a FileStream for the file
var fileStream:FileStream = new FileStream();

//open the file to read
fileStream.open(file, FileMode.READ);

//read the file into a string
var encryptedText:String = fileStream.readUTFBytes(fileStream.bytesAvailable);

//close the file
fileStream.close();

//define encryption key
var key:ByteArray = Hex.toArray("NewTorontoGroup");

//set key
var aes:AESKey = new AESKey(key);

//put encrypted text into ByteArray
var decryptedBytes:ByteArray = Hex.toArray( encryptedText );

//decrypt the bytearray
aes.decrypt( decryptedBytes );

//convert the decrypted bytearray to a string and display
txtDecrypted.text += decryptedBytes.toString();

}

]]>
</mx:Script>

<mx:TextArea id="txtDecrypted" text="" wordWrap="true" width="100%" height="100%" />

</mx:WindowedApplication>

Run the Decrypt app.  Minimize Flex builder and drag the “Encrypted.txt” file from your desktop and drop it on the Decrypt app.  You should see your the encrypted text displayed as decrypted plain text. This illustrated the basic mechanics required to encrypt and decrypt text in ActionScript3 using the as3crypto library.

New Toronto Group

timm

NTG Announces Blog

Sunday, December 13th, 2009

December, 2009 – New Toronto Group announced the start of a blog to provide in-depth technical discussions of the various technologies in which we have expertise. Employees will offer tips and techniques based on their experience with projects and teaching authorized courses in areas such as Adobe Flex, Adobe Livecycle, Coldfusion, Microsoft Silverlight, and Microsoft Sharepoint.

Chad Upton, who is heading up the initiative said, “You know, we have a wealth of knowledge that comes from our day to day experience with these products and we needed a good place to share that expertise. This blog will allow us to maintain a searchable repository of technical information that will be available to people both inside and outside of the company.”

To view our blog, visit: http://www.newyyz.com/NtgSite/blog/index.php

timm

Adobe Connect: Toronto Seminar (Commercial) – Feb 3, 2010

Friday, December 11th, 2009

New Toronto Group and Adobe Systems have partnered to provide Adobe Acrobat Connect Pro software. Rated number one for Web Conferencing in 2009 by TopTen Reviews, Connect Pro is a “must see” if your organization is evaluating eLearning and conferencing software tools.

Join New Toronto Group and Adobe for a live seminar showcasing how Adobe Acrobat Connect Pro can provide the ability to captivate audiences with interactive web meetings and virtual classroom experiences. This award winning package provides unique capabilities including:

  • Flash technology base – allows easy access to on line sessions.
  • Reduced network requirements – allows better interactivity.
  • Strong security – feel comfortable with sharing information.
  • Feature rich environment – based on established software base.
  • 7th generation solution – thousands of customers worldwide.

Learn how companies like Panasonic, Toshiba and Wal-mart have implented Adobe Connect Pro for their eConferencing and eTraining needs.

Date / Time: February 3, 8:30am – 11:00am

Location: Ryerson University, Oakham House, 63 Gould St., Thomas Lounge

To register: http://ntg.mmalliance.acrobat.com/febtor/event/registration.html
For more details, phone 866-464-7790 x.4041

timm

Adobe Connect: Ottawa Seminar (Federal Gov't) – Jan 27, 2010

Friday, December 11th, 2009

New Toronto Group and Adobe Systems have partnered to provide Adobe Acrobat Connect Pro software. Rated number one for Web Conferencing in 2009 by TopTen Reviews, Connect Pro is a “must see” if your organization is evaluating eLearning and conferencing software tools. Connect Pro is also available on the Federal Government DISO.

Join New Toronto Group and Adobe for a live seminar showcasing how Adobe Acrobat Connect Pro can provide the ability to captivate audiences with interactive web meetings and virtual classroom experiences. This award winning package provides unique capabilities including:

  • Flash technology base – allows easy access to on line sessions.
  • Reduced network requirements – allows better interactivity.
  • Strong security – feel comfortable with sharing information.
  • Feature rich environment – based on established software base.
  • 7th generation solution – thousands of customers worldwide.

Learn how organizations like the Ontario Ministry of Health, the Ontario Ministry of Education and U.S. Dept. of Defence have rolled-out Adobe Connect Pro for their Web Conferencing and eLearning needs. Connect Pro is currently used by several Canadian Federal Government departments including NRC, DND, HRSDC and CRA.

Date / Time: January 27, 8:30am – 11:00am

Location: Adobe Systems Canada, 343 Preston Street, Ottawa, Acadia Room

To register: http://ntg.mmalliance.acrobat.com/jan27ott/event/registration.html
For more details, phone 866-464-7790 x.4041

timm

WordPress Lessons Learned

Thursday, December 10th, 2009

We decided to implement a blog on our web site using the popular package WordPress, but we didn’t really want to use their hosting services.  In the process of integrating with our existing site we learned a few lessons.

  • We wanted to use WordPress as a light Content Management System for News and Events.  The tags that can be applied to posts helped us retrieve only news or events, for example get_posts(‘tag=News’,'numberposts=3′).  We didn’t want to use Categories because we wanted to save them for our technical content.
  • On the main blog page we wanted to exclude News and Events, so we used  query_posts(array(‘tag__not_in’ => array(DB_NEWS_TAG_ID, DB_EVENTS_TAG_ID))).  We defined the TAG_IDs and wrote our own SQL to eliminate some joins and only retrieve the few fields that we needed.
  • For Events on our home page we wanted future events to appear in chronological order descending down the page followed by past events in reverse chronological order.  We created a metakey, ‘event_date’, to give us something to sort on and used query_posts(‘meta_key=event_date&tag=HomePage&numberposts=5&orderby=metavalue&order=ASC’), though we later wrote our own SQL.
  • We wanted to eliminate the News and Events from the Recent Posts section of the Sidebar, so we modified default-widgets.php with the same tag__not_in syntax.
  • Our site uses a lot of css styling and we wanted the look and feel of the blog to be the same, so we created our own theme by copying the default and cutting it back to the bare minimum and then adding back in just the styles we needed.  One of our instructors who teaches Dreamweaver CS4: Website Development, one of the Adobe Training courses that we offer, and knows a lot about CSS gave us some advice on how to do this.
  • In the end we found that our raw sql for reading content did not fix up the html sufficiently and we went back to using the WordPress rendering functions.
  • We had to define our smtp server in wp-config, a step we missed in the WordPress install instructions.
  • We also had to give write permissions to the wp-content/uploads directory.

All in all we have found implementing WordPress to have been an interesting learning experience, especially since the php it uses is a long way from the Adobe Flex and Coldfusion that we use and teach and know inside out.