public EncryptedWorkspace(Workspace workspace, EncryptionStrategy encryptionStrategy)
        {
            Workspace          = workspace;
            EncryptionStrategy = encryptionStrategy;

            Configuration = workspace.Configuration;
            workspace.ClearConfiguration();

            StringWriter stringWriter = new StringWriter();
            JsonWriter   jsonWriter   = new JsonWriter(false);

            jsonWriter.Write(workspace, stringWriter);

            Id                = workspace.Id;
            Name              = workspace.Name;
            Description       = workspace.Description;
            Version           = workspace.Version;
            Revision          = workspace.Revision;
            LastModifiedAgent = workspace.LastModifiedAgent;
            LastModifiedUser  = workspace.LastModifiedUser;
            Thumbnail         = workspace.Thumbnail;

            Plaintext  = stringWriter.ToString();
            Ciphertext = encryptionStrategy.Encrypt(Plaintext);
        }
예제 #2
0
        public EncryptedWorkspace(Workspace workspace, EncryptionStrategy encryptionStrategy)
        {
            this.Workspace          = workspace;
            this.EncryptionStrategy = encryptionStrategy;

            StringWriter stringWriter = new StringWriter();
            JsonWriter   jsonWriter   = new JsonWriter(false);

            jsonWriter.Write(workspace, stringWriter);

            this.Id          = workspace.Id;
            this.Name        = workspace.Name;
            this.Description = workspace.Description;
            this.Thumbnail   = workspace.Thumbnail;

            this.Plaintext  = stringWriter.ToString();
            this.Ciphertext = encryptionStrategy.Encrypt(Plaintext);
        }