| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- //
- // System.Security.Cryptography CryptoStream.cs
- //
- // Author:
- // Thomas Neidhart ([email protected])
- //
- using System;
- using System.IO;
- namespace System.Security.Cryptography
- {
- public class CryptoStream : Stream
- {
- private CryptoStreamMode _mode;
-
- public CryptoStream(Stream stream, ICryptoTransform transform, CryptoStreamMode mode)
- {
- _mode = mode;
- }
-
- public override bool CanRead
- {
- get {
- switch (_mode) {
- case CryptoStreamMode.Read:
- return true;
-
- case CryptoStreamMode.Write:
- return false;
-
- default:
- return false;
- }
- }
- }
- public override bool CanSeek
- {
- get {
- return false;
- }
- }
- public override bool CanWrite
- {
- get {
- switch (_mode) {
- case CryptoStreamMode.Read:
- return false;
-
- case CryptoStreamMode.Write:
- return true;
-
- default:
- return false;
- }
- }
- }
-
- public override long Length
- {
- get {
- throw new NotSupportedException("Length property not supported by CryptoStream");
- }
- }
- public override long Position
- {
- get {
- throw new NotSupportedException("Position property not supported by CryptoStream");
- }
- set {
- throw new NotSupportedException("Position property not supported by CryptoStream");
- }
- }
- public override int Read(byte[] buffer, int offset, int count)
- {
- // TODO: implement
- return 0;
- }
-
- public override void Write(byte[] buffer, int offset, int count)
- {
- // TODO: implement
- }
-
- public override void Flush()
- {
- // TODO: implement
- }
-
- public void FlushFinalBlock()
- {
- if (_mode != CryptoStreamMode.Write)
- throw new NotSupportedException("cannot flush a non-writeable CryptoStream");
-
- // TODO: implement
- }
-
- public override long Seek(long offset, SeekOrigin origin)
- {
- throw new NotSupportedException("cannot seek a CryptoStream");
- }
-
- public override void SetLength(long value)
- {
- // LAMESPEC: should throw NotSupportedException like Seek??
- return;
- }
-
- } // CryptoStream
-
- } // System.Security.Cryptography
|