11.07.2015 Views

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

816 <strong>Improving</strong> <strong>Web</strong> <strong>Application</strong> <strong>Security</strong>: <strong>Threats</strong> <strong>and</strong> Countermeasures7. Add the following public properties to mirror those provided by the associatedpermission class.public bool Encrypt{get {return _encrypt;}set {_encrypt = value;}}public bool Decrypt{get {return _decrypt;}set {_decrypt = value;}}public bool UserStore{get {return _userStore;}set {_userStore = value;}}public bool MachineStore{get {return _machineStore;}set {_machineStore = value;}}8. Implement <strong>Security</strong>PermissionAttribute.CreatePermission. This method createsa permission object that can then be serialized <strong>and</strong> persisted with the specified<strong>Security</strong>Action enumeration in an assembly’s metadata.public override IPermission CreatePermission(){// The runtime automatically provides a property to indicate// whether or not an unrestricted instance is required.if((Unrestricted) || ((_encrypt && _decrypt) &&(_userStore && _machineStore))){return new EncryptionPermission(PermissionState.Unrestricted);}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!