
//============================================================================================================
// Microsoft Updater Application Block for .NET
//  http://msdn.microsoft.com/library/en-us/dnbda/html/updater.asp
//	
// KeyGenerator.cs
// 
//============================================================================================================
// Copyright (C) 2000-2001 Microsoft Corporation
// All rights reserved.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR
// FITNESS FOR A PARTICULAR PURPOSE.
//============================================================================================================


using System;
using System.Security.Cryptography;
using System.Xml;

namespace ManifestUtility
{
	public class KeyGenerator
	{
		private XmlDocument _privateKey;
		private XmlDocument _publicKey;

		public KeyGenerator()
		{
			//Use RSA Provider to generate public / private key pair
			RSACryptoServiceProvider RSA = new RSACryptoServiceProvider();

			//  create the xml-docs
			_privateKey = new XmlDocument();
			_publicKey = new XmlDocument();

			//  use RSA convenience methods to stuff public and private keys into dom's
			_privateKey.LoadXml( RSA.ToXmlString( true ));
			_publicKey.LoadXml(  RSA.ToXmlString( false ) );
		}

		public XmlDocument PrivateKey
		{
			get
			{
				return _privateKey;
			}
		}
		public XmlDocument PublicKey
		{
			get
			{
				return _publicKey;
			}
		}

	}
}
