Category Archives: code

AES interoperability between .Net and iPhone

One of my projects requires encrypting data on the iPhone and decrypting it using .Net. This is easy to do with the Common Crypto library in the iPhone SDK and the AesCryptoServiceProvider class in .Net, but the encryption parameters have to be the same for it to work.

I couldn’t figure it out, but the geniuses at StackOverflow did, so I am posting my results here. The zip file includes a basic iPhone app and a .Net console project with helpful classes to do the encryption/decryption and base64 conversion. I didn’t write most of the code – thanks to Blue Beetle for the .Net code and Greg Haygood for the Objective C.

Download zip.

ASP.Net: Adding feed auto-discovery & meta tags to the page header

Every now and then, I will post code snippets which others might find useful.  Here is one:

How to add an RSS auto-discovery meta tag to the page header:

 Private Sub AddRSSLink(ByVal title As String, ByVal URL As String)
        Dim link As New HtmlLink
        link.Attributes.Add("type", "application/rss+xml")
        link.Attributes.Add("rel", "alternate")
        link.Attributes.Add("title", title)
        link.Attributes.Add("href", URL)
        Page.Header.Controls.Add(link)
    End Sub

What about meta tags?

Dim hm As New HtmlMeta()
hm.Name = "Description" ' Or Keywords
hm.Content = "Description..."
Page.Header.Controls.Add(hm)

Why not just put this in the .aspx you ask? Check out the tags on this page for the answer.