Confuser.Core/Marker.cs
/// <summary>
///     Loads the Strong Name Key at the specified path with a optional password.
/// </summary>
/// <param name="context">The working context.</param>
/// <param name="path">The path to the key.</param>
/// <param name="pass">
///     The password of the certificate at <paramref name="path" /> if
///     it is a pfx file; otherwise, <c>null</c>.
/// </param>
/// <returns>The loaded Strong Name Key.</returns>
// Token: 0x06000192 RID: 402 RVA: 0x0000CF5C File Offset: 0x0000B15C
Loads the Strong Name Key at the specified path with a optional password.
Loads the Strong Name Key at the specified path with a optional password .
public static StrongNameKey LoadSNKey(ConfuserContext context, string path, string pass)
		{
			if (path == null)
			{
				return null;
			}
			StrongNameKey result;
			try
			{
				if (pass != null)
				{
					X509Certificate2 cert = new X509Certificate2();
					cert.Import(path, pass, X509KeyStorageFlags.Exportable);
					RSACryptoServiceProvider rsa = cert.PrivateKey as RSACryptoServiceProvider;
					if (rsa == null)
					{
						throw new ArgumentException("RSA key does not present in the certificate.", "path");
					}
					result = new StrongNameKey(rsa.ExportCspBlob(true));
				}
				else
				{
					result = new StrongNameKey(path);
				}
			}
			catch (Exception ex)
			{
				context.Logger.ErrorException("Cannot load the Strong Name Key located at: " + path, ex);
				throw new ConfuserException(ex);
			}
			return result;
		}
public static StrongNameKey LoadSNKey ( ConfuserContext context , string path , string pass ) { if ( path == null ) { return null ; } StrongNameKey result ; try { if ( pass != null ) { X509Certificate2 cert = new X509Certificate2 ( ) ; cert . Import ( path , pass , X509KeyStorageFlags . Exportable ) ; RSACryptoServiceProvider rsa = cert . PrivateKey as RSACryptoServiceProvider ; if ( rsa == null ) { throw new ArgumentException ( " " , " " ) ; } result = new StrongNameKey ( rsa . ExportCspBlob ( true ) ) ; } else { result = new StrongNameKey ( path ) ; } } catch ( Exception ex ) { context . Logger . ErrorException ( " " + path , ex ) ; throw new ConfuserException ( ex ) ; } return result ; }
Loads the Strong Name Key at the specified path with a optional password.
Loads the Strong Name Key at the specified path with a optional password .
The loaded Strong Name Key.
The loaded Strong Name Key .
context
ConfuserContext
The working context.
The working context .
path
string
The path to the key.
The path to the key .
pass
string
The password of the certificate at  if
it is a pfx file; otherwise, null
The password of the certificate at if it is a pfx file ; otherwise null