Ejemplo n.º 1
0
        public MD(MDType type)
        {
            EVP_MD *    md     = null; // Statically allocated (MT), don't free
            EVP_MD_CTX *handle = null;

            if ((md = MD.GetMD(type)) == null)
            {
                throw new EVPException();
            }

            if ((handle = _MD.EVP_MD_CTX_create()) == null)
            {
                goto Bailout;
            }

            if (_MD.EVP_DigestInit_ex(handle, md, IntPtr.Zero) == 0)
            {
                goto Bailout;
            }

            this._handle = handle;
            this._type   = type;

            return;

Bailout:
            if (handle != null)
            {
                _MD.EVP_MD_CTX_destroy(handle);
            }
            throw new EVPException();
        }
Ejemplo n.º 2
0
 public void Dispose()
 {
     if (this._handle != null)
     {
         _MD.EVP_MD_CTX_destroy(this._handle);
     }
     this._handle = null;
 }
Ejemplo n.º 3
0
Archivo: OpenSSL.cs Proyecto: haf/miTLS
 public void Dispose()
 {
     if (this._handle != null)
         _MD.EVP_MD_CTX_destroy(this._handle);
     this._handle = null;
 }
Ejemplo n.º 4
0
Archivo: OpenSSL.cs Proyecto: haf/miTLS
        public MD(MDType type)
        {
            EVP_MD* md = null; // Statically allocated (MT), don't free
            EVP_MD_CTX* handle = null;

            if ((md = MD.GetMD(type)) == null)
                throw new EVPException();

            if ((handle = _MD.EVP_MD_CTX_create()) == null)
                goto Bailout;

            if (_MD.EVP_DigestInit_ex(handle, md, IntPtr.Zero) == 0)
                goto Bailout;

            this._handle = handle;
            this._type = type;
        
            return ;

        Bailout:
            if (handle != null)
                _MD.EVP_MD_CTX_destroy(handle);
            throw new EVPException();
        }
Ejemplo n.º 5
0
 public static extern int EVP_DigestFinal_ex(EVP_MD_CTX *handle, byte[] array, IntPtr psize);
Ejemplo n.º 6
0
 public static extern int EVP_DigestUpdate(EVP_MD_CTX *handle, byte[] array, UIntPtr size);
Ejemplo n.º 7
0
 public static extern int EVP_DigestInit_ex(EVP_MD_CTX *handle, EVP_MD *type, IntPtr engine);
Ejemplo n.º 8
0
 public static extern EVP_MD *EVP_MD_CTX_md(EVP_MD_CTX *handle);
Ejemplo n.º 9
0
 public static extern void EVP_MD_CTX_destroy(EVP_MD_CTX *handle);