Files
2026-06-04 11:42:34 +02:00

227 lines
9.6 KiB
C#

using System;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
namespace System.Security.Permissions
{
/// <summary>Specifies access rights for specific key containers. This class cannot be inherited.</summary>
// Token: 0x02000555 RID: 1365
[ComVisible(true)]
[Serializable]
public sealed class KeyContainerPermissionAccessEntry
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> class, using the specified cryptographic service provider (CSP) parameters and access permissions.</summary>
/// <param name="parameters">A <see cref="T:System.Security.Cryptography.CspParameters" /> object that contains the cryptographic service provider (CSP) parameters. </param>
/// <param name="flags">A bitwise combination of the <see cref="T:System.Security.Permissions.KeyContainerPermissionFlags" /> values. </param>
/// <exception cref="T:System.ArgumentException">The resulting entry would have unrestricted access. </exception>
// Token: 0x060031D7 RID: 12759 RVA: 0x000AB594 File Offset: 0x000A9794
public KeyContainerPermissionAccessEntry(CspParameters parameters, KeyContainerPermissionFlags flags)
{
if (parameters == null)
{
throw new ArgumentNullException("parameters");
}
this.ProviderName = parameters.ProviderName;
this.ProviderType = parameters.ProviderType;
this.KeyContainerName = parameters.KeyContainerName;
this.KeySpec = parameters.KeyNumber;
this.Flags = flags;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> class, using the specified key container name and access permissions.</summary>
/// <param name="keyContainerName">The name of the key container. </param>
/// <param name="flags">A bitwise combination of the <see cref="T:System.Security.Permissions.KeyContainerPermissionFlags" /> values. </param>
/// <exception cref="T:System.ArgumentException">The resulting entry would have unrestricted access. </exception>
// Token: 0x060031D8 RID: 12760 RVA: 0x000AB5F0 File Offset: 0x000A97F0
public KeyContainerPermissionAccessEntry(string keyContainerName, KeyContainerPermissionFlags flags)
{
this.KeyContainerName = keyContainerName;
this.Flags = flags;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> class with the specified property values.</summary>
/// <param name="keyStore">The name of the key store. </param>
/// <param name="providerName">The name of the provider. </param>
/// <param name="providerType">The type code for the provider. See the <see cref="P:System.Security.Permissions.KeyContainerPermissionAccessEntry.ProviderType" /> property for values. </param>
/// <param name="keyContainerName">The name of the key container. </param>
/// <param name="keySpec">The key specification. See the <see cref="P:System.Security.Permissions.KeyContainerPermissionAccessEntry.KeySpec" /> property for values. </param>
/// <param name="flags">A bitwise combination of the <see cref="T:System.Security.Permissions.KeyContainerPermissionFlags" /> values. </param>
/// <exception cref="T:System.ArgumentException">The resulting entry would have unrestricted access. </exception>
// Token: 0x060031D9 RID: 12761 RVA: 0x000AB608 File Offset: 0x000A9808
public KeyContainerPermissionAccessEntry(string keyStore, string providerName, int providerType, string keyContainerName, int keySpec, KeyContainerPermissionFlags flags)
{
this.KeyStore = keyStore;
this.ProviderName = providerName;
this.ProviderType = providerType;
this.KeyContainerName = keyContainerName;
this.KeySpec = keySpec;
this.Flags = flags;
}
/// <summary>Gets or sets the key container permissions.</summary>
/// <returns>A bitwise combination of the <see cref="T:System.Security.Permissions.KeyContainerPermissionFlags" /> values. The default is <see cref="F:System.Security.Permissions.KeyContainerPermissionFlags.NoFlags" />.</returns>
// Token: 0x170009C0 RID: 2496
// (get) Token: 0x060031DA RID: 12762 RVA: 0x000AB648 File Offset: 0x000A9848
// (set) Token: 0x060031DB RID: 12763 RVA: 0x000AB650 File Offset: 0x000A9850
public KeyContainerPermissionFlags Flags
{
get
{
return this._flags;
}
set
{
if ((value & KeyContainerPermissionFlags.AllFlags) != KeyContainerPermissionFlags.NoFlags)
{
string text = string.Format(Locale.GetText("Invalid enum {0}"), value);
throw new ArgumentException(text, "KeyContainerPermissionFlags");
}
this._flags = value;
}
}
/// <summary>Gets or sets the key container name.</summary>
/// <returns>The name of the key container.</returns>
/// <exception cref="T:System.ArgumentException">The resulting entry would have unrestricted access. </exception>
// Token: 0x170009C1 RID: 2497
// (get) Token: 0x060031DC RID: 12764 RVA: 0x000AB694 File Offset: 0x000A9894
// (set) Token: 0x060031DD RID: 12765 RVA: 0x000AB69C File Offset: 0x000A989C
public string KeyContainerName
{
get
{
return this._containerName;
}
set
{
this._containerName = value;
}
}
/// <summary>Gets or sets the key specification.</summary>
/// <returns>One of the AT_ values defined in the Wincrypt.h header file.</returns>
/// <exception cref="T:System.ArgumentException">The resulting entry would have unrestricted access. </exception>
// Token: 0x170009C2 RID: 2498
// (get) Token: 0x060031DE RID: 12766 RVA: 0x000AB6A8 File Offset: 0x000A98A8
// (set) Token: 0x060031DF RID: 12767 RVA: 0x000AB6B0 File Offset: 0x000A98B0
public int KeySpec
{
get
{
return this._spec;
}
set
{
this._spec = value;
}
}
/// <summary>Gets or sets the name of the key store.</summary>
/// <returns>The name of the key store.</returns>
/// <exception cref="T:System.ArgumentException">The resulting entry would have unrestricted access. </exception>
// Token: 0x170009C3 RID: 2499
// (get) Token: 0x060031E0 RID: 12768 RVA: 0x000AB6BC File Offset: 0x000A98BC
// (set) Token: 0x060031E1 RID: 12769 RVA: 0x000AB6C4 File Offset: 0x000A98C4
public string KeyStore
{
get
{
return this._store;
}
set
{
this._store = value;
}
}
/// <summary>Gets or sets the provider name.</summary>
/// <returns>The name of the provider.</returns>
/// <exception cref="T:System.ArgumentException">The resulting entry would have unrestricted access. </exception>
// Token: 0x170009C4 RID: 2500
// (get) Token: 0x060031E2 RID: 12770 RVA: 0x000AB6D0 File Offset: 0x000A98D0
// (set) Token: 0x060031E3 RID: 12771 RVA: 0x000AB6D8 File Offset: 0x000A98D8
public string ProviderName
{
get
{
return this._providerName;
}
set
{
this._providerName = value;
}
}
/// <summary>Gets or sets the provider type.</summary>
/// <returns>One of the PROV_ values defined in the Wincrypt.h header file.</returns>
/// <exception cref="T:System.ArgumentException">The resulting entry would have unrestricted access. </exception>
// Token: 0x170009C5 RID: 2501
// (get) Token: 0x060031E4 RID: 12772 RVA: 0x000AB6E4 File Offset: 0x000A98E4
// (set) Token: 0x060031E5 RID: 12773 RVA: 0x000AB6EC File Offset: 0x000A98EC
public int ProviderType
{
get
{
return this._type;
}
set
{
this._type = value;
}
}
/// <summary>Determines whether the specified <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> object is equal to the current instance.</summary>
/// <returns>true if the specified <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> is equal to the current <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> object; otherwise, false.</returns>
/// <param name="o">The <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> object to compare with the currentinstance. </param>
// Token: 0x060031E6 RID: 12774 RVA: 0x000AB6F8 File Offset: 0x000A98F8
public override bool Equals(object o)
{
if (o == null)
{
return false;
}
KeyContainerPermissionAccessEntry keyContainerPermissionAccessEntry = o as KeyContainerPermissionAccessEntry;
return keyContainerPermissionAccessEntry != null && this._flags == keyContainerPermissionAccessEntry._flags && !(this._containerName != keyContainerPermissionAccessEntry._containerName) && !(this._store != keyContainerPermissionAccessEntry._store) && !(this._providerName != keyContainerPermissionAccessEntry._providerName) && this._type == keyContainerPermissionAccessEntry._type;
}
/// <summary>Gets a hash code for the current instance that is suitable for use in hashing algorithms and data structures such as a hash table.</summary>
/// <returns>A hash code for the current <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> object.</returns>
// Token: 0x060031E7 RID: 12775 RVA: 0x000AB78C File Offset: 0x000A998C
public override int GetHashCode()
{
int num = this._type ^ this._spec ^ (int)this._flags;
if (this._containerName != null)
{
num ^= this._containerName.GetHashCode();
}
if (this._store != null)
{
num ^= this._store.GetHashCode();
}
if (this._providerName != null)
{
num ^= this._providerName.GetHashCode();
}
return num;
}
// Token: 0x04001474 RID: 5236
private KeyContainerPermissionFlags _flags;
// Token: 0x04001475 RID: 5237
private string _containerName;
// Token: 0x04001476 RID: 5238
private int _spec;
// Token: 0x04001477 RID: 5239
private string _store;
// Token: 0x04001478 RID: 5240
private string _providerName;
// Token: 0x04001479 RID: 5241
private int _type;
}
}