ECDiffieHellmanPublicKey.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / System / Security / Cryptography / ECDiffieHellmanPublicKey.cs / 1305376 / ECDiffieHellmanPublicKey.cs

                            // ==++== 
//
//   Copyright (c) Microsoft Corporation.  All rights reserved.
//
// ==--== 

using System; 
using System.Runtime.Serialization; 
using System.Diagnostics.Contracts;
 
namespace System.Security.Cryptography {
    /// 
    ///     Wrapper for public key material passed between parties during Diffie-Hellman key material generation
    ///  
    [Serializable]
    [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] 
    public abstract class ECDiffieHellmanPublicKey : IDisposable { 
        private byte[] m_keyBlob;
 
        protected ECDiffieHellmanPublicKey(byte[] keyBlob) {
            Contract.Ensures(m_keyBlob != null);

            if (keyBlob == null) { 
                throw new ArgumentNullException("keyBlob");
            } 
 
            m_keyBlob = keyBlob.Clone() as byte[];
        } 

        public void Dispose() {
            Dispose(true);
        } 

        protected virtual void Dispose(bool disposing) { 
            return; 
        }
 
        public virtual byte[] ToByteArray() {
            Contract.Assert(m_keyBlob != null);
            return m_keyBlob.Clone() as byte[];
        } 

        public abstract string ToXmlString(); 
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// ==++== 
//
//   Copyright (c) Microsoft Corporation.  All rights reserved.
//
// ==--== 

using System; 
using System.Runtime.Serialization; 
using System.Diagnostics.Contracts;
 
namespace System.Security.Cryptography {
    /// 
    ///     Wrapper for public key material passed between parties during Diffie-Hellman key material generation
    ///  
    [Serializable]
    [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] 
    public abstract class ECDiffieHellmanPublicKey : IDisposable { 
        private byte[] m_keyBlob;
 
        protected ECDiffieHellmanPublicKey(byte[] keyBlob) {
            Contract.Ensures(m_keyBlob != null);

            if (keyBlob == null) { 
                throw new ArgumentNullException("keyBlob");
            } 
 
            m_keyBlob = keyBlob.Clone() as byte[];
        } 

        public void Dispose() {
            Dispose(true);
        } 

        protected virtual void Dispose(bool disposing) { 
            return; 
        }
 
        public virtual byte[] ToByteArray() {
            Contract.Assert(m_keyBlob != null);
            return m_keyBlob.Clone() as byte[];
        } 

        public abstract string ToXmlString(); 
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.

                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK