public int ChangeKey(string SourcePackage, string TargetPackage, byte[] OldKey, byte[] NewKey)
        {
            log("Changing key for {0} / {1}", SourcePackage, TargetPackage);

            string osz2FilenameOld = s3getToTemp("osz2/" + SourcePackage);
            string osz2FilenameNew = osz2FilenameOld + ".new";

            try
            {
                //ensure an existing new file doesn't existing exist.
                File.Delete(osz2FilenameNew);

                if (!File.Exists(osz2FilenameOld))
                {
                    log("couldn't find local file {0}", osz2FilenameOld);
                    return((int)UpdateResponseCode.FileDoesNotExist);
                }

                using (MapPackage oldPackage = new MapPackage(osz2FilenameOld, OldKey, false, false))
                    using (MapPackage newPackage = new MapPackage(osz2FilenameNew, NewKey, true, false))
                    {
                        Dictionary <MapMetaType, string> metaData = oldPackage.GetAllMetadata();

                        foreach (KeyValuePair <MapMetaType, string> mapMeta in metaData)
                        {
                            newPackage.AddMetadata(mapMeta.Key, mapMeta.Value);
                        }

                        List <FileInfo> fileInfo = oldPackage.GetFileInfo();
                        foreach (FileInfo fo in fileInfo)
                        {
                            using (var br = new BinaryReader(oldPackage.GetFile(fo.Filename)))
                            {
                                newPackage.AddFile(fo.Filename, br.ReadBytes((int)br.BaseStream.Length),
                                                   fo.CreationTime, fo.ModifiedTime);
                            }
                        }

                        newPackage.Save();
                    }

                s3putFile("osz2/" + TargetPackage, osz2FilenameNew);
                File.Delete(osz2FilenameNew);
            }
            catch (Exception e)
            {
                File.Delete(osz2FilenameOld);
                File.Delete(osz2FilenameNew);
                log(e);
            }

            return((int)UpdateResponseCode.UpdateSuccessful);
        }