"景先生毕设|www.jxszl.com

C# DataProtectionScope类代码示例

2023-12-29 17:49编辑: www.jxszl.com景先生毕设
本文整理汇总了C#中DataProtectionScope类的典型用法代码示例。如果您正苦于以下问题:C#DataProtectionScope类的具体用法?C#DataProtectionScope怎么用?C#DataProtectionScope使用的例子?这里精选的类代码示例或许可以为您提供帮助。 示例1:DecryptDataFromStream publicbyte[]DecryptDataFromStream(byte[]entropy,DataProtectionScopescope,Streamstream,intlength) { if(stream==null) thrownewArgumentNullException("stream"); if(length<=0) thrownewArgumentException("Length"); if(entropy==null) thrownewArgumentNullException("entropy"); if(entropy.Length<=0) thrownewArgumentException("Entropy"); varinBuffer=newbyte[length]; byte[]outBuffer; //Readtheencrypteddatafromastream. if(stream.CanRead) { stream.Read(inBuffer,0,length); outBuffer=ProtectedData.Unprotect(inBuffer,entropy,scope); } else { thrownewIOException("Couldnotreadthestream."); } //Returnthelengththatwaswrittentothestream. returnoutBuffer; }
原文链接:http://www.jxszl.com/biancheng/C/556873.html