'AmazonS3Helper: Option Public Use "AmazonS3" Use "libHMAC_SHA1" '********************************************************* '* Copyright (c) 2008 Tom O'Neil '* http://codepress.net/b/disclaimer/ '* AmazonS3Helper '********************************************************* Const mysecretkey = "--YourSecretKey--" Const myAccessKey = "--YourAccessKey--" Class AmazonS3Helper 'Private dateTime As NotesDateTime Private mydate As XSD_DATETIME Private mykey As XSD_STRING Private mysig As XSD_STRING Private functionStr As String Private AmazonStr As String Sub New(functionString As String ) AmazonStr = "AmazonS3" functionStr = functionString Set mydate = New XSD_DATETIME Set mysig = New XSD_STRING Set mykey = New XSD_STRING Call Regenerate() End Sub Property Get DateStamp As XSD_DATETIME Set DateStamp = mydate End Property Property Get key As XSD_String Set key = mykey End Property Property Get signature As XSD_String Set signature = mysig End Property Property Set S3Function As String FunctionStr = S3Function Call Regenerate() End Property Sub Regenerate() Dim dt As New NotesDateTime( "" ) Call dt.SetNow Dim formattedDate As String Dim HMACBuilder As String formattedDate = FormatDateToISO8601(dt) Call myDate.setValueFromString(formattedDate) Call mykey.setValueFromString(myaccesskey) HMACBuilder = AmazonStr + functionStr + formattedDate Call mySig.setValueFromString(HMAC_SHA1_B64(mysecretkey,HMACBuilder)) End Sub Function FormatDateToISO8601(aDate As NotesDateTime) As String ' Thanks to Joel Litton http://www.joelitton.net/A559B2/home.nsf/d6plinks/JLIN-5UU4B2 Dim dtLocal As NotesDateTime Dim dtGMT As NotesDateTime Set dtGMT = New NotesDateTime( Left$(aDate.GMTTime, 22) ) FormatDateToISO8601= Format$(dtGMT.LSLocalTime, "yyyy-mm-ddThh:nn:ss.000Z") End Function End Class