[Mono-list] RNGCryptoServiceProvider.cs

Mark Crichton crichton@gimp.org
Mon, 18 Feb 2002 08:58:18 -0500


--24zk1gE8NUlDmwG9
Content-Type: multipart/mixed; boundary="h31gzZEtNLTqOjlF"
Content-Disposition: inline


--h31gzZEtNLTqOjlF
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

In an effort to bring more chaos to the order that is
System.Security.Cryptography, here is the rest of the implementation
for RNGCryptoServiceProvider.

The only part I'm not too sure about are how I handle the two internal
calls.  The original method definition didn't include extern, but I
think that extern is necessary in this case, right?

Also, the constructors are still marked MonoTODO.  Two of the
constructors appear to be "not for applications", and the other two
look to be semi MS CryptoAPI dependent.  As soon as I flesh out that
problem, that should get resolved.

If someone can look this over and tell me if I did anything blatantly
wrong, I'd like to know.  If someone who can check it in can do that
for me, I'd appreciate it (Miguel set up my CVS account, but I think
the SSH key got a bit bungled...since I can't authenticate :( ).

Thanks,
Mark

--h31gzZEtNLTqOjlF
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="RNG.cs"
Content-Transfer-Encoding: quoted-printable

//=0D
// System.Security.Cryptography.RNGCryptoServiceProvider=0D
//=0D
// Author: Mark Crichton (crichton@gimp.org)=0D
//=0D
// (C) 2002=0D
//=0D
=0D
// "In the beginning there was Chaos,=0D
// and within this Chaos was Power,=0D
// Great Power without form."=0D
// -- The Verrah Rubicon of Verena, Book One=0D
=0D
using System;=0D
using System.Runtime.CompilerServices;=0D
=0D
namespace System.Security.Cryptography {=0D
	=0D
	public class RNGCryptoServiceProvider : RandomNumberGenerator {=0D
		=0D
		[MonoTODO]=0D
		public RNGCryptoServiceProvider () {=0D
			// This will get some meaning when I figure out what the other=0D
			// three constructors do.=0D
		}=0D
		=0D
		[MonoTODO]=0D
		public RNGCryptoServiceProvider (byte[] rgb) {=0D
			// Ok, not called by app code... someone must call it, though.=0D
		}=0D
		=0D
		[MonoTODO]=0D
		public RNGCryptoServiceProvider (CspParameters cspParams) {=0D
			// Why do I have this feeling this is the MS CryptAPI...=0D
		}=0D
		=0D
		[MonoTODO]=0D
		public RNGCryptoServiceProvider (string str) {=0D
			// More !application code.  Interesting...=0D
		}=0D
		=0D
		[MethodImplAttribute(MethodImplOptions.InternalCall)]=0D
		public extern override void GetBytes (byte[] data);=0D
		=0D
		[MethodImplAttribute(MethodImplOptions.InternalCall)]=0D
		public extern override void GetNonZeroBytes (byte[] data);=0D
		=0D
		~RNGCryptoServiceProvider () {=0D
			// FIN?=0D
		}=0D
	}=0D
}=0D

--h31gzZEtNLTqOjlF--

--24zk1gE8NUlDmwG9
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (SunOS)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAjxxCHkACgkQOfj2Ja/u/oAwNgCfTnavWJyAKBgM7RwucAc86BzT
h1YAoKKtxuqfvOY/6zjznDVK0a24zYxV
=RGaN
-----END PGP SIGNATURE-----

--24zk1gE8NUlDmwG9--