scripts
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Principal;
|
||||
|
||||
namespace System.Security.AccessControl
|
||||
{
|
||||
/// <summary>Represents a set of access rights allowed or denied for a user or group. This class cannot be inherited.</summary>
|
||||
// Token: 0x02000275 RID: 629
|
||||
[ComVisible(false)]
|
||||
public sealed class SemaphoreAccessRule : AccessRule
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.AccessControl.SemaphoreAccessRule" /> class, specifying the user or group the rule applies to, the access rights, and whether the specified access rights are allowed or denied.</summary>
|
||||
/// <param name="identity">The user or group the rule applies to. Must be of type <see cref="T:System.Security.Principal.SecurityIdentifier" /> or a type such as <see cref="T:System.Security.Principal.NTAccount" /> that can be converted to type <see cref="T:System.Security.Principal.SecurityIdentifier" />.</param>
|
||||
/// <param name="eventRights">A bitwise combination of <see cref="T:System.Security.AccessControl.SemaphoreRights" /> values specifying the rights allowed or denied.</param>
|
||||
/// <param name="type">One of the <see cref="T:System.Security.AccessControl.AccessControlType" /> values specifying whether the rights are allowed or denied.</param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="eventRights" /> specifies an invalid value.-or-<paramref name="type" /> specifies an invalid value.</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="identity" /> is null. -or-<paramref name="eventRights" /> is zero.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="identity" /> is neither of type <see cref="T:System.Security.Principal.SecurityIdentifier" /> nor of a type such as <see cref="T:System.Security.Principal.NTAccount" /> that can be converted to type <see cref="T:System.Security.Principal.SecurityIdentifier" />.</exception>
|
||||
// Token: 0x06001752 RID: 5970 RVA: 0x0004E020 File Offset: 0x0004C220
|
||||
public SemaphoreAccessRule(IdentityReference identity, SemaphoreRights semaphoreRights, AccessControlType type)
|
||||
: base(identity, 0, false, InheritanceFlags.None, PropagationFlags.None, type)
|
||||
{
|
||||
this.semaphoreRights = semaphoreRights;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.AccessControl.SemaphoreAccessRule" /> class, specifying the name of the user or group the rule applies to, the access rights, and whether the specified access rights are allowed or denied.</summary>
|
||||
/// <param name="identity">The name of the user or group the rule applies to.</param>
|
||||
/// <param name="eventRights">A bitwise combination of <see cref="T:System.Security.AccessControl.SemaphoreRights" /> values specifying the rights allowed or denied.</param>
|
||||
/// <param name="type">One of the <see cref="T:System.Security.AccessControl.AccessControlType" /> values specifying whether the rights are allowed or denied.</param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="eventRights" /> specifies an invalid value.-or-<paramref name="type" /> specifies an invalid value.</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="eventRights" /> is zero.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="identity" /> is null.-or-<paramref name="identity" /> is a zero-length string.-or-<paramref name="identity" /> is longer than 512 characters.</exception>
|
||||
// Token: 0x06001753 RID: 5971 RVA: 0x0004E038 File Offset: 0x0004C238
|
||||
public SemaphoreAccessRule(string identity, SemaphoreRights semaphoreRights, AccessControlType type)
|
||||
: base(null, 0, false, InheritanceFlags.None, PropagationFlags.None, type)
|
||||
{
|
||||
this.semaphoreRights = semaphoreRights;
|
||||
}
|
||||
|
||||
/// <summary>Gets the rights allowed or denied by the access rule.</summary>
|
||||
/// <returns>A bitwise combination of <see cref="T:System.Security.AccessControl.SemaphoreRights" /> values indicating the rights allowed or denied by the access rule.</returns>
|
||||
// Token: 0x1700076A RID: 1898
|
||||
// (get) Token: 0x06001754 RID: 5972 RVA: 0x0004E050 File Offset: 0x0004C250
|
||||
public SemaphoreRights SemaphoreRights
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.semaphoreRights;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0400129D RID: 4765
|
||||
private SemaphoreRights semaphoreRights;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Principal;
|
||||
|
||||
namespace System.Security.AccessControl
|
||||
{
|
||||
/// <summary>Represents a set of access rights to be audited for a user or group. This class cannot be inherited.</summary>
|
||||
// Token: 0x02000276 RID: 630
|
||||
[ComVisible(false)]
|
||||
public sealed class SemaphoreAuditRule : AuditRule
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.AccessControl.SemaphoreAuditRule" /> class, specifying the user or group to audit, the rights to audit, and whether to audit success, failure, or both.</summary>
|
||||
/// <param name="identity">The user or group the rule applies to. Must be of type <see cref="T:System.Security.Principal.SecurityIdentifier" /> or a type such as <see cref="T:System.Security.Principal.NTAccount" /> that can be converted to type <see cref="T:System.Security.Principal.SecurityIdentifier" />.</param>
|
||||
/// <param name="eventRights">A bitwise combination of <see cref="T:System.Security.AccessControl.SemaphoreRights" /> values specifying the kinds of access to audit.</param>
|
||||
/// <param name="flags">A bitwise combination of <see cref="T:System.Security.AccessControl.AuditFlags" /> values specifying whether to audit success, failure, or both.</param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="eventRights" /> specifies an invalid value.-or-<paramref name="flags" /> specifies an invalid value.</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="identity" /> is null. -or-<paramref name="eventRights" /> is zero.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="identity" /> is neither of type <see cref="T:System.Security.Principal.SecurityIdentifier" /> nor of a type such as <see cref="T:System.Security.Principal.NTAccount" /> that can be converted to type <see cref="T:System.Security.Principal.SecurityIdentifier" />.</exception>
|
||||
// Token: 0x06001755 RID: 5973 RVA: 0x0004E058 File Offset: 0x0004C258
|
||||
public SemaphoreAuditRule(IdentityReference identity, SemaphoreRights semaphoreRights, AuditFlags flags)
|
||||
: base(identity, 0, false, InheritanceFlags.None, PropagationFlags.None, flags)
|
||||
{
|
||||
this.semaphoreRights = semaphoreRights;
|
||||
}
|
||||
|
||||
/// <summary>Gets the access rights affected by the audit rule.</summary>
|
||||
/// <returns>A bitwise combination of <see cref="T:System.Security.AccessControl.SemaphoreRights" /> values that indicates the rights affected by the audit rule.</returns>
|
||||
// Token: 0x1700076B RID: 1899
|
||||
// (get) Token: 0x06001756 RID: 5974 RVA: 0x0004E070 File Offset: 0x0004C270
|
||||
public SemaphoreRights SemaphoreRights
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.semaphoreRights;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0400129E RID: 4766
|
||||
private SemaphoreRights semaphoreRights;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.Security.AccessControl
|
||||
{
|
||||
/// <summary>Specifies the access control rights that can be applied to named system semaphore objects.</summary>
|
||||
// Token: 0x02000277 RID: 631
|
||||
[ComVisible(false)]
|
||||
[Flags]
|
||||
public enum SemaphoreRights
|
||||
{
|
||||
/// <summary>The right to release a named semaphore.</summary>
|
||||
// Token: 0x040012A0 RID: 4768
|
||||
Modify = 2,
|
||||
/// <summary>The right to delete a named semaphore.</summary>
|
||||
// Token: 0x040012A1 RID: 4769
|
||||
Delete = 65536,
|
||||
/// <summary>The right to open and copy the access rules and audit rules for a named semaphore.</summary>
|
||||
// Token: 0x040012A2 RID: 4770
|
||||
ReadPermissions = 131072,
|
||||
/// <summary>The right to change the security and audit rules associated with a named semaphore.</summary>
|
||||
// Token: 0x040012A3 RID: 4771
|
||||
ChangePermissions = 262144,
|
||||
/// <summary>The right to change the owner of a named semaphore.</summary>
|
||||
// Token: 0x040012A4 RID: 4772
|
||||
TakeOwnership = 524288,
|
||||
/// <summary>The right to wait on a named semaphore.</summary>
|
||||
// Token: 0x040012A5 RID: 4773
|
||||
Synchronize = 1048576,
|
||||
/// <summary>The right to exert full control over a named semaphore, and to modify its access rules and audit rules.</summary>
|
||||
// Token: 0x040012A6 RID: 4774
|
||||
FullControl = 2031619
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,216 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Principal;
|
||||
|
||||
namespace System.Security.AccessControl
|
||||
{
|
||||
/// <summary>Represents the Windows access control security for a named semaphore. This class cannot be inherited.</summary>
|
||||
// Token: 0x02000278 RID: 632
|
||||
[ComVisible(false)]
|
||||
public sealed class SemaphoreSecurity : NativeObjectSecurity
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.AccessControl.SemaphoreSecurity" /> class with default values.</summary>
|
||||
/// <exception cref="T:System.NotSupportedException">This class is not supported on Windows 98 or Windows Millennium Edition.</exception>
|
||||
// Token: 0x06001757 RID: 5975 RVA: 0x0004E078 File Offset: 0x0004C278
|
||||
public SemaphoreSecurity()
|
||||
: base(false, ResourceType.Unknown)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.AccessControl.SemaphoreSecurity" /> class with the specified sections of the access control security rules from the system semaphore with the specified name.</summary>
|
||||
/// <param name="name">The name of the system semaphore whose access control security rules are to be retrieved.</param>
|
||||
/// <param name="includeSections">A combination of <see cref="T:System.Security.AccessControl.AccessControlSections" /> flags specifying the sections to retrieve.</param>
|
||||
/// <exception cref="T:System.NotSupportedException">This class is not supported on Windows 98 or Windows Millennium Edition.</exception>
|
||||
// Token: 0x06001758 RID: 5976 RVA: 0x0004E084 File Offset: 0x0004C284
|
||||
public SemaphoreSecurity(string name, AccessControlSections includesections)
|
||||
: base(false, ResourceType.Unknown, name, includesections)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Gets the enumeration that the <see cref="T:System.Security.AccessControl.SemaphoreSecurity" /> class uses to represent access rights.</summary>
|
||||
/// <returns>A <see cref="T:System.Type" /> object representing the <see cref="T:System.Security.AccessControl.SemaphoreRights" /> enumeration.</returns>
|
||||
// Token: 0x1700076C RID: 1900
|
||||
// (get) Token: 0x06001759 RID: 5977 RVA: 0x0004E090 File Offset: 0x0004C290
|
||||
public override Type AccessRightType
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the type that the <see cref="T:System.Security.AccessControl.SemaphoreSecurity" /> class uses to represent access rules.</summary>
|
||||
/// <returns>A <see cref="T:System.Type" /> object representing the <see cref="T:System.Security.AccessControl.SemaphoreAccessRule" /> class.</returns>
|
||||
// Token: 0x1700076D RID: 1901
|
||||
// (get) Token: 0x0600175A RID: 5978 RVA: 0x0004E098 File Offset: 0x0004C298
|
||||
public override Type AccessRuleType
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the type that the <see cref="T:System.Security.AccessControl.SemaphoreSecurity" /> class uses to represent audit rules.</summary>
|
||||
/// <returns>A <see cref="T:System.Type" /> object representing the <see cref="T:System.Security.AccessControl.SemaphoreAuditRule" /> class.</returns>
|
||||
// Token: 0x1700076E RID: 1902
|
||||
// (get) Token: 0x0600175B RID: 5979 RVA: 0x0004E0A0 File Offset: 0x0004C2A0
|
||||
public override Type AuditRuleType
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Creates a new access control rule for the specified user, with the specified access rights, access control, and flags.</summary>
|
||||
/// <returns>A <see cref="T:System.Security.AccessControl.SemaphoreAccessRule" /> object representing the specified rights for the specified user.</returns>
|
||||
/// <param name="identityReference">An <see cref="T:System.Security.Principal.IdentityReference" /> that identifies the user or group the rule applies to.</param>
|
||||
/// <param name="accessMask">A bitwise combination of <see cref="T:System.Security.AccessControl.SemaphoreRights" /> values specifying the access rights to allow or deny, cast to an integer.</param>
|
||||
/// <param name="isInherited">Meaningless for named semaphores, because they have no hierarchy.</param>
|
||||
/// <param name="inheritanceFlags">Meaningless for named semaphores, because they have no hierarchy.</param>
|
||||
/// <param name="propagationFlags">Meaningless for named semaphores, because they have no hierarchy.</param>
|
||||
/// <param name="type">One of the <see cref="T:System.Security.AccessControl.AccessControlType" /> values specifying whether the rights are allowed or denied.</param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="accessMask" />, <paramref name="inheritanceFlags" />, <paramref name="propagationFlags" />, or <paramref name="type" /> specifies an invalid value.</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="identityReference" /> is null. -or-<paramref name="accessMask" /> is zero.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="identityReference" /> is neither of type <see cref="T:System.Security.Principal.SecurityIdentifier" />, nor of a type such as <see cref="T:System.Security.Principal.NTAccount" /> that can be converted to type <see cref="T:System.Security.Principal.SecurityIdentifier" />.</exception>
|
||||
// Token: 0x0600175C RID: 5980 RVA: 0x0004E0A8 File Offset: 0x0004C2A8
|
||||
public override AccessRule AccessRuleFactory(IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>Searches for a matching rule with which the new rule can be merged. If none are found, adds the new rule.</summary>
|
||||
/// <param name="rule">The access control rule to add.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="rule" /> is null.</exception>
|
||||
// Token: 0x0600175D RID: 5981 RVA: 0x0004E0B0 File Offset: 0x0004C2B0
|
||||
public void AddAccessRule(SemaphoreAccessRule rule)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>Searches for an audit rule with which the new rule can be merged. If none are found, adds the new rule.</summary>
|
||||
/// <param name="rule">The audit rule to add. The user specified by this rule determines the search.</param>
|
||||
// Token: 0x0600175E RID: 5982 RVA: 0x0004E0B8 File Offset: 0x0004C2B8
|
||||
public void AddAuditRule(SemaphoreAuditRule rule)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>Creates a new audit rule, specifying the user the rule applies to, the access rights to audit, and the outcome that triggers the audit rule.</summary>
|
||||
/// <returns>A <see cref="T:System.Security.AccessControl.SemaphoreAuditRule" /> object representing the specified audit rule for the specified user. The return type of the method is the base class, <see cref="T:System.Security.AccessControl.AuditRule" />, but the return value can be cast safely to the derived class.</returns>
|
||||
/// <param name="identityReference">An <see cref="T:System.Security.Principal.IdentityReference" /> that identifies the user or group the rule applies to.</param>
|
||||
/// <param name="accessMask">A bitwise combination of <see cref="T:System.Security.AccessControl.SemaphoreRights" /> values specifying the access rights to audit, cast to an integer.</param>
|
||||
/// <param name="isInherited">Meaningless for named wait handles, because they have no hierarchy.</param>
|
||||
/// <param name="inheritanceFlags">Meaningless for named wait handles, because they have no hierarchy.</param>
|
||||
/// <param name="propagationFlags">Meaningless for named wait handles, because they have no hierarchy.</param>
|
||||
/// <param name="flags">A bitwise combination of <see cref="T:System.Security.AccessControl.AuditFlags" /> values that specify whether to audit successful access, failed access, or both.</param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="accessMask" />, <paramref name="inheritanceFlags" />, <paramref name="propagationFlags" />, or <paramref name="flags" /> specifies an invalid value.</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="identityReference" /> is null. -or-<paramref name="accessMask" /> is zero.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="identityReference" /> is neither of type <see cref="T:System.Security.Principal.SecurityIdentifier" />, nor of a type such as <see cref="T:System.Security.Principal.NTAccount" /> that can be converted to type <see cref="T:System.Security.Principal.SecurityIdentifier" />.</exception>
|
||||
// Token: 0x0600175F RID: 5983 RVA: 0x0004E0C0 File Offset: 0x0004C2C0
|
||||
public override AuditRule AuditRuleFactory(IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags flags)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>Searches for an access control rule with the same user and <see cref="T:System.Security.AccessControl.AccessControlType" /> (allow or deny) as the specified rule, and with compatible inheritance and propagation flags; if such a rule is found, the rights contained in the specified access rule are removed from it.</summary>
|
||||
/// <returns>true if a compatible rule is found; otherwise false.</returns>
|
||||
/// <param name="rule">A <see cref="T:System.Security.AccessControl.SemaphoreAccessRule" /> that specifies the user and <see cref="T:System.Security.AccessControl.AccessControlType" /> to search for, and a set of inheritance and propagation flags that a matching rule, if found, must be compatible with. Specifies the rights to remove from the compatible rule, if found.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="rule" /> is null.</exception>
|
||||
// Token: 0x06001760 RID: 5984 RVA: 0x0004E0C8 File Offset: 0x0004C2C8
|
||||
public bool RemoveAccessRule(SemaphoreAccessRule rule)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>Searches for all access control rules with the same user and <see cref="T:System.Security.AccessControl.AccessControlType" /> (allow or deny) as the specified rule and, if found, removes them.</summary>
|
||||
/// <param name="rule">A <see cref="T:System.Security.AccessControl.SemaphoreAccessRule" /> that specifies the user and <see cref="T:System.Security.AccessControl.AccessControlType" /> to search for. Any rights specified by this rule are ignored.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="rule" /> is null.</exception>
|
||||
// Token: 0x06001761 RID: 5985 RVA: 0x0004E0D0 File Offset: 0x0004C2D0
|
||||
public void RemoveAccessRuleAll(SemaphoreAccessRule rule)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>Searches for an access control rule that exactly matches the specified rule and, if found, removes it.</summary>
|
||||
/// <param name="rule">The <see cref="T:System.Security.AccessControl.SemaphoreAccessRule" /> to remove.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="rule" /> is null.</exception>
|
||||
// Token: 0x06001762 RID: 5986 RVA: 0x0004E0D8 File Offset: 0x0004C2D8
|
||||
public void RemoveAccessRuleSpecific(SemaphoreAccessRule rule)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>Searches for an audit control rule with the same user as the specified rule, and with compatible inheritance and propagation flags; if a compatible rule is found, the rights contained in the specified rule are removed from it.</summary>
|
||||
/// <returns>true if a compatible rule is found; otherwise, false.</returns>
|
||||
/// <param name="rule">A <see cref="T:System.Security.AccessControl.SemaphoreAuditRule" /> that specifies the user to search for, and a set of inheritance and propagation flags that a matching rule, if found, must be compatible with. Specifies the rights to remove from the compatible rule, if found.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="rule" /> is null.</exception>
|
||||
// Token: 0x06001763 RID: 5987 RVA: 0x0004E0E0 File Offset: 0x0004C2E0
|
||||
public bool RemoveAuditRule(SemaphoreAuditRule rule)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>Searches for all audit rules with the same user as the specified rule and, if found, removes them.</summary>
|
||||
/// <param name="rule">A <see cref="T:System.Security.AccessControl.SemaphoreAuditRule" /> that specifies the user to search for. Any rights specified by this rule are ignored.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="rule" /> is null.</exception>
|
||||
// Token: 0x06001764 RID: 5988 RVA: 0x0004E0E8 File Offset: 0x0004C2E8
|
||||
public void RemoveAuditRuleAll(SemaphoreAuditRule rule)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>Searches for an audit rule that exactly matches the specified rule and, if found, removes it.</summary>
|
||||
/// <param name="rule">The <see cref="T:System.Security.AccessControl.SemaphoreAuditRule" /> to remove.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="rule" /> is null.</exception>
|
||||
// Token: 0x06001765 RID: 5989 RVA: 0x0004E0F0 File Offset: 0x0004C2F0
|
||||
public void RemoveAuditRuleSpecific(SemaphoreAuditRule rule)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>Removes all access control rules with the same user as the specified rule, regardless of <see cref="T:System.Security.AccessControl.AccessControlType" />, and then adds the specified rule.</summary>
|
||||
/// <param name="rule">The <see cref="T:System.Security.AccessControl.SemaphoreAccessRule" /> to add. The user specified by this rule determines the rules to remove before this rule is added.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="rule" /> is null.</exception>
|
||||
// Token: 0x06001766 RID: 5990 RVA: 0x0004E0F8 File Offset: 0x0004C2F8
|
||||
public void ResetAccessRule(SemaphoreAccessRule rule)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>Removes all access control rules with the same user and <see cref="T:System.Security.AccessControl.AccessControlType" /> (allow or deny) as the specified rule, and then adds the specified rule.</summary>
|
||||
/// <param name="rule">The <see cref="T:System.Security.AccessControl.SemaphoreAccessRule" /> to add. The user and <see cref="T:System.Security.AccessControl.AccessControlType" /> of this rule determine the rules to remove before this rule is added.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="rule" /> is null.</exception>
|
||||
// Token: 0x06001767 RID: 5991 RVA: 0x0004E100 File Offset: 0x0004C300
|
||||
public void SetAccessRule(SemaphoreAccessRule rule)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>Removes all audit rules with the same user as the specified rule, regardless of the <see cref="T:System.Security.AccessControl.AuditFlags" /> value, and then adds the specified rule.</summary>
|
||||
/// <param name="rule">The <see cref="T:System.Security.AccessControl.SemaphoreAuditRule" /> to add. The user specified by this rule determines the rules to remove before this rule is added.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="rule" /> is null.</exception>
|
||||
// Token: 0x06001768 RID: 5992 RVA: 0x0004E108 File Offset: 0x0004C308
|
||||
public void SetAuditRule(SemaphoreAuditRule rule)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System.Security.Authentication
|
||||
{
|
||||
/// <summary>The exception that is thrown when authentication fails for an authentication stream.</summary>
|
||||
// Token: 0x02000279 RID: 633
|
||||
[Serializable]
|
||||
public class AuthenticationException : SystemException
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Authentication.AuthenticationException" /> class with no message.</summary>
|
||||
// Token: 0x06001769 RID: 5993 RVA: 0x0004E110 File Offset: 0x0004C310
|
||||
public AuthenticationException()
|
||||
: base(global::Locale.GetText("Authentication exception."))
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Authentication.AuthenticationException" /> class with the specified message.</summary>
|
||||
/// <param name="message">A <see cref="T:System.String" /> that describes the authentication failure.</param>
|
||||
// Token: 0x0600176A RID: 5994 RVA: 0x0004E124 File Offset: 0x0004C324
|
||||
public AuthenticationException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Authentication.AuthenticationException" /> class with the specified message and inner exception.</summary>
|
||||
/// <param name="message">A <see cref="T:System.String" /> that describes the authentication failure.</param>
|
||||
/// <param name="innerException">The <see cref="T:System.Exception" /> that is the cause of the current exception.</param>
|
||||
// Token: 0x0600176B RID: 5995 RVA: 0x0004E130 File Offset: 0x0004C330
|
||||
public AuthenticationException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Authentication.AuthenticationException" /> class from the specified instances of the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> and <see cref="T:System.Runtime.Serialization.StreamingContext" /> classes.</summary>
|
||||
/// <param name="serializationInfo">A <see cref="T:System.Runtime.Serialization.SerializationInfo" /> instance that contains the information required to deserialize the new <see cref="T:System.Security.Authentication.AuthenticationException" /> instance. </param>
|
||||
/// <param name="streamingContext">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> instance. </param>
|
||||
// Token: 0x0600176C RID: 5996 RVA: 0x0004E13C File Offset: 0x0004C33C
|
||||
protected AuthenticationException(SerializationInfo serializationInfo, StreamingContext streamingContext)
|
||||
: base(serializationInfo, streamingContext)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
|
||||
namespace System.Security.Authentication
|
||||
{
|
||||
/// <summary>Defines the possible cipher algorithms for the <see cref="T:System.Net.Security.SslStream" /> class.</summary>
|
||||
// Token: 0x0200027A RID: 634
|
||||
public enum CipherAlgorithmType
|
||||
{
|
||||
/// <summary>No encryption algorithm is used.</summary>
|
||||
// Token: 0x040012A8 RID: 4776
|
||||
None,
|
||||
/// <summary>The Advanced Encryption Standard (AES) algorithm.</summary>
|
||||
// Token: 0x040012A9 RID: 4777
|
||||
Aes = 26129,
|
||||
/// <summary>The Advanced Encryption Standard (AES) algorithm with a 128 bit key.</summary>
|
||||
// Token: 0x040012AA RID: 4778
|
||||
Aes128 = 26126,
|
||||
/// <summary>The Advanced Encryption Standard (AES) algorithm with a 192 bit key.</summary>
|
||||
// Token: 0x040012AB RID: 4779
|
||||
Aes192,
|
||||
/// <summary>The Advanced Encryption Standard (AES) algorithm with a 256 bit key.</summary>
|
||||
// Token: 0x040012AC RID: 4780
|
||||
Aes256,
|
||||
/// <summary>The Data Encryption Standard (DES) algorithm.</summary>
|
||||
// Token: 0x040012AD RID: 4781
|
||||
Des = 26113,
|
||||
/// <summary>Rivest's Code 2 (RC2) algorithm.</summary>
|
||||
// Token: 0x040012AE RID: 4782
|
||||
Rc2,
|
||||
/// <summary>Rivest's Code 4 (RC4) algorithm.</summary>
|
||||
// Token: 0x040012AF RID: 4783
|
||||
Rc4 = 26625,
|
||||
/// <summary>The Triple Data Encryption Standard (3DES) algorithm.</summary>
|
||||
// Token: 0x040012B0 RID: 4784
|
||||
TripleDes = 26115
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
|
||||
namespace System.Security.Authentication
|
||||
{
|
||||
/// <summary>Specifies the algorithm used to create keys shared by the client and server.</summary>
|
||||
// Token: 0x0200027B RID: 635
|
||||
public enum ExchangeAlgorithmType
|
||||
{
|
||||
/// <summary>No key exchange algorithm is used.</summary>
|
||||
// Token: 0x040012B2 RID: 4786
|
||||
None,
|
||||
/// <summary>The Diffie Hellman ephemeral key exchange algorithm.</summary>
|
||||
// Token: 0x040012B3 RID: 4787
|
||||
DiffieHellman = 43522,
|
||||
/// <summary>The RSA public-key exchange algorithm.</summary>
|
||||
// Token: 0x040012B4 RID: 4788
|
||||
RsaKeyX = 41984,
|
||||
/// <summary>The RSA public-key signature algorithm.</summary>
|
||||
// Token: 0x040012B5 RID: 4789
|
||||
RsaSign = 9216
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
|
||||
namespace System.Security.Authentication
|
||||
{
|
||||
/// <summary>Specifies the algorithm used for generating message authentication codes (MACs).</summary>
|
||||
// Token: 0x0200027C RID: 636
|
||||
public enum HashAlgorithmType
|
||||
{
|
||||
/// <summary>No hashing algorithm is used.</summary>
|
||||
// Token: 0x040012B7 RID: 4791
|
||||
None,
|
||||
/// <summary>The Message Digest 5 (MD5) hashing algorithm.</summary>
|
||||
// Token: 0x040012B8 RID: 4792
|
||||
Md5 = 32771,
|
||||
/// <summary>The Secure Hashing Algorithm (SHA1).</summary>
|
||||
// Token: 0x040012B9 RID: 4793
|
||||
Sha1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System.Security.Authentication
|
||||
{
|
||||
/// <summary>The exception that is thrown when authentication fails for an authentication stream and cannot be retried.</summary>
|
||||
// Token: 0x0200027D RID: 637
|
||||
[Serializable]
|
||||
public class InvalidCredentialException : AuthenticationException
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Authentication.InvalidCredentialException" /> class with no message. </summary>
|
||||
// Token: 0x0600176D RID: 5997 RVA: 0x0004E148 File Offset: 0x0004C348
|
||||
public InvalidCredentialException()
|
||||
: base(global::Locale.GetText("Invalid credentials exception."))
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Authentication.InvalidCredentialException" /> class with the specified message.</summary>
|
||||
/// <param name="message">A <see cref="T:System.String" /> that describes the authentication failure.</param>
|
||||
// Token: 0x0600176E RID: 5998 RVA: 0x0004E15C File Offset: 0x0004C35C
|
||||
public InvalidCredentialException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Authentication.InvalidCredentialException" /> class with the specified message and inner exception.</summary>
|
||||
/// <param name="message">A <see cref="T:System.String" /> that describes the authentication failure.</param>
|
||||
/// <param name="innerException">The <see cref="T:System.Exception" /> that is the cause of the current exception.</param>
|
||||
// Token: 0x0600176F RID: 5999 RVA: 0x0004E168 File Offset: 0x0004C368
|
||||
public InvalidCredentialException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Authentication.InvalidCredentialException" /> class from the specified instances of the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> and <see cref="T:System.Runtime.Serialization.StreamingContext" /> classes.</summary>
|
||||
/// <param name="serializationInfo">A <see cref="T:System.Runtime.Serialization.SerializationInfo" /> instance that contains the information required to deserialize the new <see cref="T:System.Security.Authentication.InvalidCredentialException" /> instance. </param>
|
||||
/// <param name="streamingContext">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> instance. </param>
|
||||
// Token: 0x06001770 RID: 6000 RVA: 0x0004E174 File Offset: 0x0004C374
|
||||
protected InvalidCredentialException(SerializationInfo serializationInfo, StreamingContext streamingContext)
|
||||
: base(serializationInfo, streamingContext)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
|
||||
namespace System.Security.Authentication
|
||||
{
|
||||
/// <summary>Defines the possible versions of <see cref="T:System.Security.Authentication.SslProtocols" />.</summary>
|
||||
// Token: 0x0200027E RID: 638
|
||||
[Flags]
|
||||
public enum SslProtocols
|
||||
{
|
||||
/// <summary>No SSL protocol is specified.</summary>
|
||||
// Token: 0x040012BB RID: 4795
|
||||
None = 0,
|
||||
/// <summary>Specifies the SSL 2.0 protocol. SSL 2.0 has been superseded by the TLS protocol and is provided for backward compatibility only.</summary>
|
||||
// Token: 0x040012BC RID: 4796
|
||||
Ssl2 = 12,
|
||||
/// <summary>Specifies the SSL 3.0 protocol. SSL 3.0 has been superseded by the TLS protocol and is provided for backward compatibility only.</summary>
|
||||
// Token: 0x040012BD RID: 4797
|
||||
Ssl3 = 48,
|
||||
/// <summary>Specifies the TLS 1.0 security protocol. The TLS protocol is defined in IETF RFC 2246.</summary>
|
||||
// Token: 0x040012BE RID: 4798
|
||||
Tls = 192,
|
||||
/// <summary>Specifies that either Secure Sockets Layer (SSL) 3.0 or Transport Layer Security (TLS) 1.0 are acceptable for secure communications</summary>
|
||||
// Token: 0x040012BF RID: 4799
|
||||
Default = 240
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
|
||||
namespace System.Security.Cryptography
|
||||
{
|
||||
// Token: 0x020002A3 RID: 675
|
||||
internal enum AsnDecodeStatus
|
||||
{
|
||||
// Token: 0x04001399 RID: 5017
|
||||
NotDecoded = -1,
|
||||
// Token: 0x0400139A RID: 5018
|
||||
Ok,
|
||||
// Token: 0x0400139B RID: 5019
|
||||
BadAsn,
|
||||
// Token: 0x0400139C RID: 5020
|
||||
BadTag,
|
||||
// Token: 0x0400139D RID: 5021
|
||||
BadLength,
|
||||
// Token: 0x0400139E RID: 5022
|
||||
InformationNotAvailable
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,386 @@
|
||||
using System;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using Mono.Security;
|
||||
using Mono.Security.Cryptography;
|
||||
|
||||
namespace System.Security.Cryptography
|
||||
{
|
||||
/// <summary>Represents Abstract Syntax Notation One (ASN.1)-encoded data.</summary>
|
||||
// Token: 0x020002A4 RID: 676
|
||||
public class AsnEncodedData
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.AsnEncodedData" /> class.</summary>
|
||||
// Token: 0x060018A5 RID: 6309 RVA: 0x00054630 File Offset: 0x00052830
|
||||
protected AsnEncodedData()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.AsnEncodedData" /> class using a byte array.</summary>
|
||||
/// <param name="oid">A string that represents <see cref="T:System.Security.Cryptography.Oid" /> information.</param>
|
||||
/// <param name="rawData">A byte array that contains Abstract Syntax Notation One (ASN.1)-encoded data.</param>
|
||||
// Token: 0x060018A6 RID: 6310 RVA: 0x00054638 File Offset: 0x00052838
|
||||
public AsnEncodedData(string oid, byte[] rawData)
|
||||
{
|
||||
this._oid = new Oid(oid);
|
||||
this.RawData = rawData;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.AsnEncodedData" /> class using an <see cref="T:System.Security.Cryptography.Oid" /> object and a byte array.</summary>
|
||||
/// <param name="oid">An <see cref="T:System.Security.Cryptography.Oid" /> object.</param>
|
||||
/// <param name="rawData">A byte array that contains Abstract Syntax Notation One (ASN.1)-encoded data.</param>
|
||||
// Token: 0x060018A7 RID: 6311 RVA: 0x00054654 File Offset: 0x00052854
|
||||
public AsnEncodedData(Oid oid, byte[] rawData)
|
||||
{
|
||||
this.Oid = oid;
|
||||
this.RawData = rawData;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.AsnEncodedData" /> class using an instance of the <see cref="T:System.Security.Cryptography.AsnEncodedData" /> class.</summary>
|
||||
/// <param name="asnEncodedData">An instance of the <see cref="T:System.Security.Cryptography.AsnEncodedData" /> class.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="asnEncodedData" /> is null.</exception>
|
||||
// Token: 0x060018A8 RID: 6312 RVA: 0x0005466C File Offset: 0x0005286C
|
||||
public AsnEncodedData(AsnEncodedData asnEncodedData)
|
||||
{
|
||||
if (asnEncodedData == null)
|
||||
{
|
||||
throw new ArgumentNullException("asnEncodedData");
|
||||
}
|
||||
if (asnEncodedData._oid != null)
|
||||
{
|
||||
this.Oid = new Oid(asnEncodedData._oid);
|
||||
}
|
||||
this.RawData = asnEncodedData._raw;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.AsnEncodedData" /> class using a byte array.</summary>
|
||||
/// <param name="rawData">A byte array that contains Abstract Syntax Notation One (ASN.1)-encoded data.</param>
|
||||
// Token: 0x060018A9 RID: 6313 RVA: 0x000546B8 File Offset: 0x000528B8
|
||||
public AsnEncodedData(byte[] rawData)
|
||||
{
|
||||
this.RawData = rawData;
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the <see cref="T:System.Security.Cryptography.Oid" /> value for an <see cref="T:System.Security.Cryptography.AsnEncodedData" /> object.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.Oid" /> object.</returns>
|
||||
// Token: 0x170007BB RID: 1979
|
||||
// (get) Token: 0x060018AA RID: 6314 RVA: 0x000546C8 File Offset: 0x000528C8
|
||||
// (set) Token: 0x060018AB RID: 6315 RVA: 0x000546D0 File Offset: 0x000528D0
|
||||
public Oid Oid
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._oid;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
this._oid = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._oid = new Oid(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the Abstract Syntax Notation One (ASN.1)-encoded data represented in a byte array.</summary>
|
||||
/// <returns>A byte array that represents the Abstract Syntax Notation One (ASN.1)-encoded data.</returns>
|
||||
/// <exception cref="T:System.ArgumentNullException">The value is null.</exception>
|
||||
// Token: 0x170007BC RID: 1980
|
||||
// (get) Token: 0x060018AC RID: 6316 RVA: 0x000546F0 File Offset: 0x000528F0
|
||||
// (set) Token: 0x060018AD RID: 6317 RVA: 0x000546F8 File Offset: 0x000528F8
|
||||
public byte[] RawData
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._raw;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("RawData");
|
||||
}
|
||||
this._raw = (byte[])value.Clone();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Copies information from an <see cref="T:System.Security.Cryptography.AsnEncodedData" /> object.</summary>
|
||||
/// <param name="asnEncodedData">The <see cref="T:System.Security.Cryptography.AsnEncodedData" /> object to base the new object on.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="asnEncodedData " />is null.</exception>
|
||||
// Token: 0x060018AE RID: 6318 RVA: 0x00054728 File Offset: 0x00052928
|
||||
public virtual void CopyFrom(AsnEncodedData asnEncodedData)
|
||||
{
|
||||
if (asnEncodedData == null)
|
||||
{
|
||||
throw new ArgumentNullException("asnEncodedData");
|
||||
}
|
||||
if (asnEncodedData._oid == null)
|
||||
{
|
||||
this.Oid = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Oid = new Oid(asnEncodedData._oid);
|
||||
}
|
||||
this.RawData = asnEncodedData._raw;
|
||||
}
|
||||
|
||||
/// <summary>Returns a formatted version of the Abstract Syntax Notation One (ASN.1)-encoded data as a string.</summary>
|
||||
/// <returns>A formatted string that represents the Abstract Syntax Notation One (ASN.1)-encoded data.</returns>
|
||||
/// <param name="multiLine">true if the return string should contain carriage returns; otherwise, false.</param>
|
||||
// Token: 0x060018AF RID: 6319 RVA: 0x0005477C File Offset: 0x0005297C
|
||||
public virtual string Format(bool multiLine)
|
||||
{
|
||||
if (this._raw == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
if (this._oid == null)
|
||||
{
|
||||
return this.Default(multiLine);
|
||||
}
|
||||
return this.ToString(multiLine);
|
||||
}
|
||||
|
||||
// Token: 0x060018B0 RID: 6320 RVA: 0x000547AC File Offset: 0x000529AC
|
||||
internal virtual string ToString(bool multiLine)
|
||||
{
|
||||
string value = this._oid.Value;
|
||||
switch (value)
|
||||
{
|
||||
case "2.5.29.19":
|
||||
return this.BasicConstraintsExtension(multiLine);
|
||||
case "2.5.29.37":
|
||||
return this.EnhancedKeyUsageExtension(multiLine);
|
||||
case "2.5.29.15":
|
||||
return this.KeyUsageExtension(multiLine);
|
||||
case "2.5.29.14":
|
||||
return this.SubjectKeyIdentifierExtension(multiLine);
|
||||
case "2.5.29.17":
|
||||
return this.SubjectAltName(multiLine);
|
||||
case "2.16.840.1.113730.1.1":
|
||||
return this.NetscapeCertType(multiLine);
|
||||
}
|
||||
return this.Default(multiLine);
|
||||
}
|
||||
|
||||
// Token: 0x060018B1 RID: 6321 RVA: 0x00054898 File Offset: 0x00052A98
|
||||
internal string Default(bool multiLine)
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (int i = 0; i < this._raw.Length; i++)
|
||||
{
|
||||
stringBuilder.Append(this._raw[i].ToString("x2"));
|
||||
if (i != this._raw.Length - 1)
|
||||
{
|
||||
stringBuilder.Append(" ");
|
||||
}
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
// Token: 0x060018B2 RID: 6322 RVA: 0x00054904 File Offset: 0x00052B04
|
||||
internal string BasicConstraintsExtension(bool multiLine)
|
||||
{
|
||||
string text;
|
||||
try
|
||||
{
|
||||
global::System.Security.Cryptography.X509Certificates.X509BasicConstraintsExtension x509BasicConstraintsExtension = new global::System.Security.Cryptography.X509Certificates.X509BasicConstraintsExtension(this, false);
|
||||
text = x509BasicConstraintsExtension.ToString(multiLine);
|
||||
}
|
||||
catch
|
||||
{
|
||||
text = string.Empty;
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
// Token: 0x060018B3 RID: 6323 RVA: 0x0005495C File Offset: 0x00052B5C
|
||||
internal string EnhancedKeyUsageExtension(bool multiLine)
|
||||
{
|
||||
string text;
|
||||
try
|
||||
{
|
||||
global::System.Security.Cryptography.X509Certificates.X509EnhancedKeyUsageExtension x509EnhancedKeyUsageExtension = new global::System.Security.Cryptography.X509Certificates.X509EnhancedKeyUsageExtension(this, false);
|
||||
text = x509EnhancedKeyUsageExtension.ToString(multiLine);
|
||||
}
|
||||
catch
|
||||
{
|
||||
text = string.Empty;
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
// Token: 0x060018B4 RID: 6324 RVA: 0x000549B4 File Offset: 0x00052BB4
|
||||
internal string KeyUsageExtension(bool multiLine)
|
||||
{
|
||||
string text;
|
||||
try
|
||||
{
|
||||
global::System.Security.Cryptography.X509Certificates.X509KeyUsageExtension x509KeyUsageExtension = new global::System.Security.Cryptography.X509Certificates.X509KeyUsageExtension(this, false);
|
||||
text = x509KeyUsageExtension.ToString(multiLine);
|
||||
}
|
||||
catch
|
||||
{
|
||||
text = string.Empty;
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
// Token: 0x060018B5 RID: 6325 RVA: 0x00054A0C File Offset: 0x00052C0C
|
||||
internal string SubjectKeyIdentifierExtension(bool multiLine)
|
||||
{
|
||||
string text;
|
||||
try
|
||||
{
|
||||
global::System.Security.Cryptography.X509Certificates.X509SubjectKeyIdentifierExtension x509SubjectKeyIdentifierExtension = new global::System.Security.Cryptography.X509Certificates.X509SubjectKeyIdentifierExtension(this, false);
|
||||
text = x509SubjectKeyIdentifierExtension.ToString(multiLine);
|
||||
}
|
||||
catch
|
||||
{
|
||||
text = string.Empty;
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
// Token: 0x060018B6 RID: 6326 RVA: 0x00054A64 File Offset: 0x00052C64
|
||||
internal string SubjectAltName(bool multiLine)
|
||||
{
|
||||
if (this._raw.Length < 5)
|
||||
{
|
||||
return "Information Not Available";
|
||||
}
|
||||
string text3;
|
||||
try
|
||||
{
|
||||
ASN1 asn = new ASN1(this._raw);
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (int i = 0; i < asn.Count; i++)
|
||||
{
|
||||
ASN1 asn2 = asn[i];
|
||||
byte tag = asn2.Tag;
|
||||
string text;
|
||||
string text2;
|
||||
if (tag != 129)
|
||||
{
|
||||
if (tag != 130)
|
||||
{
|
||||
text = string.Format("Unknown ({0})=", asn2.Tag);
|
||||
text2 = CryptoConvert.ToHex(asn2.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
text = "DNS Name=";
|
||||
text2 = Encoding.ASCII.GetString(asn2.Value);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
text = "RFC822 Name=";
|
||||
text2 = Encoding.ASCII.GetString(asn2.Value);
|
||||
}
|
||||
stringBuilder.Append(text);
|
||||
stringBuilder.Append(text2);
|
||||
if (multiLine)
|
||||
{
|
||||
stringBuilder.Append(Environment.NewLine);
|
||||
}
|
||||
else if (i < asn.Count - 1)
|
||||
{
|
||||
stringBuilder.Append(", ");
|
||||
}
|
||||
}
|
||||
text3 = stringBuilder.ToString();
|
||||
}
|
||||
catch
|
||||
{
|
||||
text3 = string.Empty;
|
||||
}
|
||||
return text3;
|
||||
}
|
||||
|
||||
// Token: 0x060018B7 RID: 6327 RVA: 0x00054BCC File Offset: 0x00052DCC
|
||||
internal string NetscapeCertType(bool multiLine)
|
||||
{
|
||||
if (this._raw.Length < 4 || this._raw[0] != 3 || this._raw[1] != 2)
|
||||
{
|
||||
return "Information Not Available";
|
||||
}
|
||||
int num = this._raw[3] >> (int)this._raw[2] << (int)this._raw[2];
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
if ((num & 128) == 128)
|
||||
{
|
||||
stringBuilder.Append("SSL Client Authentication");
|
||||
}
|
||||
if ((num & 64) == 64)
|
||||
{
|
||||
if (stringBuilder.Length > 0)
|
||||
{
|
||||
stringBuilder.Append(", ");
|
||||
}
|
||||
stringBuilder.Append("SSL Server Authentication");
|
||||
}
|
||||
if ((num & 32) == 32)
|
||||
{
|
||||
if (stringBuilder.Length > 0)
|
||||
{
|
||||
stringBuilder.Append(", ");
|
||||
}
|
||||
stringBuilder.Append("SMIME");
|
||||
}
|
||||
if ((num & 16) == 16)
|
||||
{
|
||||
if (stringBuilder.Length > 0)
|
||||
{
|
||||
stringBuilder.Append(", ");
|
||||
}
|
||||
stringBuilder.Append("Signature");
|
||||
}
|
||||
if ((num & 8) == 8)
|
||||
{
|
||||
if (stringBuilder.Length > 0)
|
||||
{
|
||||
stringBuilder.Append(", ");
|
||||
}
|
||||
stringBuilder.Append("Unknown cert type");
|
||||
}
|
||||
if ((num & 4) == 4)
|
||||
{
|
||||
if (stringBuilder.Length > 0)
|
||||
{
|
||||
stringBuilder.Append(", ");
|
||||
}
|
||||
stringBuilder.Append("SSL CA");
|
||||
}
|
||||
if ((num & 2) == 2)
|
||||
{
|
||||
if (stringBuilder.Length > 0)
|
||||
{
|
||||
stringBuilder.Append(", ");
|
||||
}
|
||||
stringBuilder.Append("SMIME CA");
|
||||
}
|
||||
if ((num & 1) == 1)
|
||||
{
|
||||
if (stringBuilder.Length > 0)
|
||||
{
|
||||
stringBuilder.Append(", ");
|
||||
}
|
||||
stringBuilder.Append("Signature CA");
|
||||
}
|
||||
stringBuilder.AppendFormat(" ({0})", num.ToString("x2"));
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
// Token: 0x0400139F RID: 5023
|
||||
internal Oid _oid;
|
||||
|
||||
// Token: 0x040013A0 RID: 5024
|
||||
internal byte[] _raw;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace System.Security.Cryptography
|
||||
{
|
||||
/// <summary>Represents a collection of <see cref="T:System.Security.Cryptography.AsnEncodedData" /> objects. This class cannot be inherited.</summary>
|
||||
// Token: 0x020002A5 RID: 677
|
||||
public sealed class AsnEncodedDataCollection : ICollection, IEnumerable
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.AsnEncodedDataCollection" /> class.</summary>
|
||||
// Token: 0x060018B8 RID: 6328 RVA: 0x00054DAC File Offset: 0x00052FAC
|
||||
public AsnEncodedDataCollection()
|
||||
{
|
||||
this._list = new ArrayList();
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.AsnEncodedDataCollection" /> class and adds an <see cref="T:System.Security.Cryptography.AsnEncodedData" /> object to the collection.</summary>
|
||||
/// <param name="asnEncodedData">The <see cref="T:System.Security.Cryptography.AsnEncodedData" /> object to add to the collection.</param>
|
||||
// Token: 0x060018B9 RID: 6329 RVA: 0x00054DC0 File Offset: 0x00052FC0
|
||||
public AsnEncodedDataCollection(AsnEncodedData asnEncodedData)
|
||||
{
|
||||
this._list = new ArrayList();
|
||||
this._list.Add(asnEncodedData);
|
||||
}
|
||||
|
||||
/// <summary>Copies the <see cref="T:System.Security.Cryptography.AsnEncodedDataCollection" /> object into an array.</summary>
|
||||
/// <param name="array">The array that the <see cref="T:System.Security.Cryptography.AsnEncodedDataCollection" /> object is to be copied into.</param>
|
||||
/// <param name="index">The location where the copy operation starts.</param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="array" /> is a multidimensional array, which is not supported by this method.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">The length for <paramref name="index" /> is invalid.</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="array" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">The length for <paramref name="index" /> is out of range.</exception>
|
||||
// Token: 0x060018BA RID: 6330 RVA: 0x00054DE0 File Offset: 0x00052FE0
|
||||
void ICollection.CopyTo(Array array, int index)
|
||||
{
|
||||
this._list.CopyTo(array, index);
|
||||
}
|
||||
|
||||
/// <summary>Returns an <see cref="T:System.Security.Cryptography.AsnEncodedDataEnumerator" /> object that can be used to navigate the <see cref="T:System.Security.Cryptography.AsnEncodedDataCollection" /> object.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.AsnEncodedDataEnumerator" /> object that can be used to navigate the collection.</returns>
|
||||
// Token: 0x060018BB RID: 6331 RVA: 0x00054DF0 File Offset: 0x00052FF0
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return new AsnEncodedDataEnumerator(this);
|
||||
}
|
||||
|
||||
/// <summary>Gets the number of <see cref="T:System.Security.Cryptography.AsnEncodedData" /> objects in a collection.</summary>
|
||||
/// <returns>The number of <see cref="T:System.Security.Cryptography.AsnEncodedData" /> objects.</returns>
|
||||
// Token: 0x170007BD RID: 1981
|
||||
// (get) Token: 0x060018BC RID: 6332 RVA: 0x00054DF8 File Offset: 0x00052FF8
|
||||
public int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._list.Count;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a value that indicates whether access to the <see cref="T:System.Security.Cryptography.AsnEncodedDataCollection" /> object is thread safe.</summary>
|
||||
/// <returns>false in all cases.</returns>
|
||||
// Token: 0x170007BE RID: 1982
|
||||
// (get) Token: 0x060018BD RID: 6333 RVA: 0x00054E08 File Offset: 0x00053008
|
||||
public bool IsSynchronized
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._list.IsSynchronized;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets an <see cref="T:System.Security.Cryptography.AsnEncodedData" /> object from the <see cref="T:System.Security.Cryptography.AsnEncodedDataCollection" /> object.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.AsnEncodedData" /> object.</returns>
|
||||
/// <param name="index">The location in the collection.</param>
|
||||
// Token: 0x170007BF RID: 1983
|
||||
public AsnEncodedData this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return (AsnEncodedData)this._list[index];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets an object that can be used to synchronize access to the <see cref="T:System.Security.Cryptography.AsnEncodedDataCollection" /> object.</summary>
|
||||
/// <returns>An object used to synchronize access to the <see cref="T:System.Security.Cryptography.AsnEncodedDataCollection" /> object.</returns>
|
||||
// Token: 0x170007C0 RID: 1984
|
||||
// (get) Token: 0x060018BF RID: 6335 RVA: 0x00054E2C File Offset: 0x0005302C
|
||||
public object SyncRoot
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._list.SyncRoot;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Adds an <see cref="T:System.Security.Cryptography.AsnEncodedData" /> object to the <see cref="T:System.Security.Cryptography.AsnEncodedDataCollection" /> object.</summary>
|
||||
/// <returns>The index of the added <see cref="T:System.Security.Cryptography.AsnEncodedData" /> object.</returns>
|
||||
/// <param name="asnEncodedData">The <see cref="T:System.Security.Cryptography.AsnEncodedData" /> object to add to the collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="asnEncodedData" /> is null.</exception>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">Neither of the OIDs are null and the OIDs do not match.</exception>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">One of the OIDs is null and the OIDs do not match.</exception>
|
||||
// Token: 0x060018C0 RID: 6336 RVA: 0x00054E3C File Offset: 0x0005303C
|
||||
public int Add(AsnEncodedData asnEncodedData)
|
||||
{
|
||||
return this._list.Add(asnEncodedData);
|
||||
}
|
||||
|
||||
/// <summary>Copies the <see cref="T:System.Security.Cryptography.AsnEncodedDataCollection" /> object into an array.</summary>
|
||||
/// <param name="array">The array that the <see cref="T:System.Security.Cryptography.AsnEncodedDataCollection" /> object is to be copied into.</param>
|
||||
/// <param name="index">The location where the copy operation starts.</param>
|
||||
// Token: 0x060018C1 RID: 6337 RVA: 0x00054E4C File Offset: 0x0005304C
|
||||
public void CopyTo(AsnEncodedData[] array, int index)
|
||||
{
|
||||
this._list.CopyTo(array, index);
|
||||
}
|
||||
|
||||
/// <summary>Returns an <see cref="T:System.Security.Cryptography.AsnEncodedDataEnumerator" /> object that can be used to navigate the <see cref="T:System.Security.Cryptography.AsnEncodedDataCollection" /> object.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.AsnEncodedDataEnumerator" /> object.</returns>
|
||||
// Token: 0x060018C2 RID: 6338 RVA: 0x00054E5C File Offset: 0x0005305C
|
||||
public AsnEncodedDataEnumerator GetEnumerator()
|
||||
{
|
||||
return new AsnEncodedDataEnumerator(this);
|
||||
}
|
||||
|
||||
/// <summary>Removes an <see cref="T:System.Security.Cryptography.AsnEncodedData" /> object from the <see cref="T:System.Security.Cryptography.AsnEncodedDataCollection" /> object.</summary>
|
||||
/// <param name="asnEncodedData">The <see cref="T:System.Security.Cryptography.AsnEncodedData" /> object to remove.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="asnEncodedData" /> is null.</exception>
|
||||
// Token: 0x060018C3 RID: 6339 RVA: 0x00054E64 File Offset: 0x00053064
|
||||
public void Remove(AsnEncodedData asnEncodedData)
|
||||
{
|
||||
this._list.Remove(asnEncodedData);
|
||||
}
|
||||
|
||||
// Token: 0x040013A2 RID: 5026
|
||||
private ArrayList _list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace System.Security.Cryptography
|
||||
{
|
||||
/// <summary>Provides the ability to navigate through an <see cref="T:System.Security.Cryptography.AsnEncodedDataCollection" /> object. This class cannot be inherited.</summary>
|
||||
// Token: 0x020002A6 RID: 678
|
||||
public sealed class AsnEncodedDataEnumerator : IEnumerator
|
||||
{
|
||||
// Token: 0x060018C4 RID: 6340 RVA: 0x00054E74 File Offset: 0x00053074
|
||||
internal AsnEncodedDataEnumerator(AsnEncodedDataCollection collection)
|
||||
{
|
||||
this._collection = collection;
|
||||
this._position = -1;
|
||||
}
|
||||
|
||||
/// <summary>Gets the current <see cref="T:System.Security.Cryptography.AsnEncodedData" /> object in an <see cref="T:System.Security.Cryptography.AsnEncodedDataCollection" /> object.</summary>
|
||||
/// <returns>The current <see cref="T:System.Security.Cryptography.AsnEncodedData" /> object.</returns>
|
||||
// Token: 0x170007C1 RID: 1985
|
||||
// (get) Token: 0x060018C5 RID: 6341 RVA: 0x00054E8C File Offset: 0x0005308C
|
||||
object IEnumerator.Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._position < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
return this._collection[this._position];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the current <see cref="T:System.Security.Cryptography.AsnEncodedData" /> object in an <see cref="T:System.Security.Cryptography.AsnEncodedDataCollection" /> object.</summary>
|
||||
/// <returns>The current <see cref="T:System.Security.Cryptography.AsnEncodedData" /> object in the collection.</returns>
|
||||
// Token: 0x170007C2 RID: 1986
|
||||
// (get) Token: 0x060018C6 RID: 6342 RVA: 0x00054EB4 File Offset: 0x000530B4
|
||||
public AsnEncodedData Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._position < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
return this._collection[this._position];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Advances to the next <see cref="T:System.Security.Cryptography.AsnEncodedData" /> object in an <see cref="T:System.Security.Cryptography.AsnEncodedDataCollection" /> object.</summary>
|
||||
/// <returns>true, if the enumerator was successfully advanced to the next element; false, if the enumerator has passed the end of the collection.</returns>
|
||||
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created.</exception>
|
||||
// Token: 0x060018C7 RID: 6343 RVA: 0x00054EDC File Offset: 0x000530DC
|
||||
public bool MoveNext()
|
||||
{
|
||||
if (++this._position < this._collection.Count)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
this._position = this._collection.Count - 1;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>Sets an enumerator to its initial position.</summary>
|
||||
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created.</exception>
|
||||
// Token: 0x060018C8 RID: 6344 RVA: 0x00054F20 File Offset: 0x00053120
|
||||
public void Reset()
|
||||
{
|
||||
this._position = -1;
|
||||
}
|
||||
|
||||
// Token: 0x040013A3 RID: 5027
|
||||
private AsnEncodedDataCollection _collection;
|
||||
|
||||
// Token: 0x040013A4 RID: 5028
|
||||
private int _position;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,229 @@
|
||||
using System;
|
||||
|
||||
namespace System.Security.Cryptography
|
||||
{
|
||||
/// <summary>Represents a cryptographic object identifier. This class cannot be inherited.</summary>
|
||||
// Token: 0x020002A7 RID: 679
|
||||
public sealed class Oid
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.Oid" /> class.</summary>
|
||||
// Token: 0x060018C9 RID: 6345 RVA: 0x00054F2C File Offset: 0x0005312C
|
||||
public Oid()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.Oid" /> class using a string value of an <see cref="T:System.Security.Cryptography.Oid" /> object.</summary>
|
||||
/// <param name="oid">An object identifier.</param>
|
||||
// Token: 0x060018CA RID: 6346 RVA: 0x00054F34 File Offset: 0x00053134
|
||||
public Oid(string oid)
|
||||
{
|
||||
if (oid == null)
|
||||
{
|
||||
throw new ArgumentNullException("oid");
|
||||
}
|
||||
this._value = oid;
|
||||
this._name = this.GetName(oid);
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.Oid" /> class using the specified value and friendly name.</summary>
|
||||
/// <param name="value">The dotted number of the identifier.</param>
|
||||
/// <param name="friendlyName">The friendly name of the identifier.</param>
|
||||
// Token: 0x060018CB RID: 6347 RVA: 0x00054F64 File Offset: 0x00053164
|
||||
public Oid(string value, string friendlyName)
|
||||
{
|
||||
this._value = value;
|
||||
this._name = friendlyName;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.Oid" /> class using the specified <see cref="T:System.Security.Cryptography.Oid" /> object.</summary>
|
||||
/// <param name="oid">The object identifier information to use to create the new object identifier.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="oid " />is null.</exception>
|
||||
// Token: 0x060018CC RID: 6348 RVA: 0x00054F7C File Offset: 0x0005317C
|
||||
public Oid(Oid oid)
|
||||
{
|
||||
if (oid == null)
|
||||
{
|
||||
throw new ArgumentNullException("oid");
|
||||
}
|
||||
this._value = oid.Value;
|
||||
this._name = oid.FriendlyName;
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the friendly name of the identifier.</summary>
|
||||
/// <returns>The friendly name of the identifier.</returns>
|
||||
// Token: 0x170007C3 RID: 1987
|
||||
// (get) Token: 0x060018CD RID: 6349 RVA: 0x00054FB0 File Offset: 0x000531B0
|
||||
// (set) Token: 0x060018CE RID: 6350 RVA: 0x00054FB8 File Offset: 0x000531B8
|
||||
public string FriendlyName
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._name;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._name = value;
|
||||
this._value = this.GetValue(this._name);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the dotted number of the identifier.</summary>
|
||||
/// <returns>The dotted number of the identifier.</returns>
|
||||
// Token: 0x170007C4 RID: 1988
|
||||
// (get) Token: 0x060018CF RID: 6351 RVA: 0x00054FD4 File Offset: 0x000531D4
|
||||
// (set) Token: 0x060018D0 RID: 6352 RVA: 0x00054FDC File Offset: 0x000531DC
|
||||
public string Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._value;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._value = value;
|
||||
this._name = this.GetName(this._value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060018D1 RID: 6353 RVA: 0x00054FF8 File Offset: 0x000531F8
|
||||
private string GetName(string oid)
|
||||
{
|
||||
switch (oid)
|
||||
{
|
||||
case "1.2.840.113549.1.1.1":
|
||||
return "RSA";
|
||||
case "1.2.840.113549.1.7.1":
|
||||
return "PKCS 7 Data";
|
||||
case "1.2.840.113549.1.9.3":
|
||||
return "Content Type";
|
||||
case "1.2.840.113549.1.9.4":
|
||||
return "Message Digest";
|
||||
case "1.2.840.113549.1.9.5":
|
||||
return "Signing Time";
|
||||
case "1.2.840.113549.3.7":
|
||||
return "3des";
|
||||
case "2.5.29.19":
|
||||
return "Basic Constraints";
|
||||
case "2.5.29.15":
|
||||
return "Key Usage";
|
||||
case "2.5.29.37":
|
||||
return "Enhanced Key Usage";
|
||||
case "2.5.29.14":
|
||||
return "Subject Key Identifier";
|
||||
case "2.5.29.17":
|
||||
return "Subject Alternative Name";
|
||||
case "2.16.840.1.113730.1.1":
|
||||
return "Netscape Cert Type";
|
||||
case "1.2.840.113549.2.5":
|
||||
return "md5";
|
||||
case "1.3.14.3.2.26":
|
||||
return "sha1";
|
||||
}
|
||||
return this._name;
|
||||
}
|
||||
|
||||
// Token: 0x060018D2 RID: 6354 RVA: 0x00055184 File Offset: 0x00053384
|
||||
private string GetValue(string name)
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case "RSA":
|
||||
return "1.2.840.113549.1.1.1";
|
||||
case "PKCS 7 Data":
|
||||
return "1.2.840.113549.1.7.1";
|
||||
case "Content Type":
|
||||
return "1.2.840.113549.1.9.3";
|
||||
case "Message Digest":
|
||||
return "1.2.840.113549.1.9.4";
|
||||
case "Signing Time":
|
||||
return "1.2.840.113549.1.9.5";
|
||||
case "3des":
|
||||
return "1.2.840.113549.3.7";
|
||||
case "Basic Constraints":
|
||||
return "2.5.29.19";
|
||||
case "Key Usage":
|
||||
return "2.5.29.15";
|
||||
case "Enhanced Key Usage":
|
||||
return "2.5.29.37";
|
||||
case "Subject Key Identifier":
|
||||
return "2.5.29.14";
|
||||
case "Subject Alternative Name":
|
||||
return "2.5.29.17";
|
||||
case "Netscape Cert Type":
|
||||
return "2.16.840.1.113730.1.1";
|
||||
case "md5":
|
||||
return "1.2.840.113549.2.5";
|
||||
case "sha1":
|
||||
return "1.3.14.3.2.26";
|
||||
}
|
||||
return this._value;
|
||||
}
|
||||
|
||||
// Token: 0x040013A5 RID: 5029
|
||||
internal const string oidRSA = "1.2.840.113549.1.1.1";
|
||||
|
||||
// Token: 0x040013A6 RID: 5030
|
||||
internal const string nameRSA = "RSA";
|
||||
|
||||
// Token: 0x040013A7 RID: 5031
|
||||
internal const string oidPkcs7Data = "1.2.840.113549.1.7.1";
|
||||
|
||||
// Token: 0x040013A8 RID: 5032
|
||||
internal const string namePkcs7Data = "PKCS 7 Data";
|
||||
|
||||
// Token: 0x040013A9 RID: 5033
|
||||
internal const string oidPkcs9ContentType = "1.2.840.113549.1.9.3";
|
||||
|
||||
// Token: 0x040013AA RID: 5034
|
||||
internal const string namePkcs9ContentType = "Content Type";
|
||||
|
||||
// Token: 0x040013AB RID: 5035
|
||||
internal const string oidPkcs9MessageDigest = "1.2.840.113549.1.9.4";
|
||||
|
||||
// Token: 0x040013AC RID: 5036
|
||||
internal const string namePkcs9MessageDigest = "Message Digest";
|
||||
|
||||
// Token: 0x040013AD RID: 5037
|
||||
internal const string oidPkcs9SigningTime = "1.2.840.113549.1.9.5";
|
||||
|
||||
// Token: 0x040013AE RID: 5038
|
||||
internal const string namePkcs9SigningTime = "Signing Time";
|
||||
|
||||
// Token: 0x040013AF RID: 5039
|
||||
internal const string oidMd5 = "1.2.840.113549.2.5";
|
||||
|
||||
// Token: 0x040013B0 RID: 5040
|
||||
internal const string nameMd5 = "md5";
|
||||
|
||||
// Token: 0x040013B1 RID: 5041
|
||||
internal const string oid3Des = "1.2.840.113549.3.7";
|
||||
|
||||
// Token: 0x040013B2 RID: 5042
|
||||
internal const string name3Des = "3des";
|
||||
|
||||
// Token: 0x040013B3 RID: 5043
|
||||
internal const string oidSha1 = "1.3.14.3.2.26";
|
||||
|
||||
// Token: 0x040013B4 RID: 5044
|
||||
internal const string nameSha1 = "sha1";
|
||||
|
||||
// Token: 0x040013B5 RID: 5045
|
||||
internal const string oidSubjectAltName = "2.5.29.17";
|
||||
|
||||
// Token: 0x040013B6 RID: 5046
|
||||
internal const string nameSubjectAltName = "Subject Alternative Name";
|
||||
|
||||
// Token: 0x040013B7 RID: 5047
|
||||
internal const string oidNetscapeCertType = "2.16.840.1.113730.1.1";
|
||||
|
||||
// Token: 0x040013B8 RID: 5048
|
||||
internal const string nameNetscapeCertType = "Netscape Cert Type";
|
||||
|
||||
// Token: 0x040013B9 RID: 5049
|
||||
private string _value;
|
||||
|
||||
// Token: 0x040013BA RID: 5050
|
||||
private string _name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace System.Security.Cryptography
|
||||
{
|
||||
/// <summary>Represents a collection of <see cref="T:System.Security.Cryptography.Oid" /> objects. This class cannot be inherited.</summary>
|
||||
// Token: 0x020002A8 RID: 680
|
||||
public sealed class OidCollection : ICollection, IEnumerable
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.OidCollection" /> class.</summary>
|
||||
// Token: 0x060018D3 RID: 6355 RVA: 0x00055310 File Offset: 0x00053510
|
||||
public OidCollection()
|
||||
{
|
||||
this._list = new ArrayList();
|
||||
}
|
||||
|
||||
/// <summary>Copies the <see cref="T:System.Security.Cryptography.OidCollection" /> object into an array.</summary>
|
||||
/// <param name="array">The array to copy the <see cref="T:System.Security.Cryptography.OidCollection" /> object to.</param>
|
||||
/// <param name="index">The location where the copy operation starts.</param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="array" /> cannot be a multidimensional array.-or-The length of <paramref name="array" /> is an invalid offset length.</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="array" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">The value of <paramref name="index" /> is out range.</exception>
|
||||
// Token: 0x060018D4 RID: 6356 RVA: 0x00055324 File Offset: 0x00053524
|
||||
void ICollection.CopyTo(Array array, int index)
|
||||
{
|
||||
this._list.CopyTo(array, index);
|
||||
}
|
||||
|
||||
/// <summary>Returns an <see cref="T:System.Security.Cryptography.OidEnumerator" /> object that can be used to navigate the <see cref="T:System.Security.Cryptography.OidCollection" /> object.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.OidEnumerator" /> object that can be used to navigate the collection.</returns>
|
||||
// Token: 0x060018D5 RID: 6357 RVA: 0x00055334 File Offset: 0x00053534
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return new OidEnumerator(this);
|
||||
}
|
||||
|
||||
/// <summary>Gets the number of <see cref="T:System.Security.Cryptography.Oid" /> objects in a collection. </summary>
|
||||
/// <returns>The number of <see cref="T:System.Security.Cryptography.Oid" /> objects in a collection.</returns>
|
||||
// Token: 0x170007C5 RID: 1989
|
||||
// (get) Token: 0x060018D6 RID: 6358 RVA: 0x0005533C File Offset: 0x0005353C
|
||||
public int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._list.Count;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a value that indicates whether access to the <see cref="T:System.Security.Cryptography.OidCollection" /> object is thread safe.</summary>
|
||||
/// <returns>false in all cases.</returns>
|
||||
// Token: 0x170007C6 RID: 1990
|
||||
// (get) Token: 0x060018D7 RID: 6359 RVA: 0x0005534C File Offset: 0x0005354C
|
||||
public bool IsSynchronized
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._list.IsSynchronized;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets an <see cref="T:System.Security.Cryptography.Oid" /> object from the <see cref="T:System.Security.Cryptography.OidCollection" /> object.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.Oid" /> object.</returns>
|
||||
/// <param name="index">The location of the <see cref="T:System.Security.Cryptography.Oid" /> object in the collection.</param>
|
||||
// Token: 0x170007C7 RID: 1991
|
||||
public Oid this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return (Oid)this._list[index];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the first <see cref="T:System.Security.Cryptography.Oid" /> object that contains a value of the <see cref="P:System.Security.Cryptography.Oid.Value" /> property or a value of the <see cref="P:System.Security.Cryptography.Oid.FriendlyName" /> property that matches the specified string value from the <see cref="T:System.Security.Cryptography.OidCollection" /> object.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.Oid" /> object.</returns>
|
||||
/// <param name="oid">A string that represents a <see cref="P:System.Security.Cryptography.Oid.Value" /> property or a <see cref="P:System.Security.Cryptography.Oid.FriendlyName" /> property.</param>
|
||||
// Token: 0x170007C8 RID: 1992
|
||||
public Oid this[string oid]
|
||||
{
|
||||
get
|
||||
{
|
||||
foreach (object obj in this._list)
|
||||
{
|
||||
Oid oid2 = (Oid)obj;
|
||||
if (oid2.Value == oid)
|
||||
{
|
||||
return oid2;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets an object that can be used to synchronize access to the <see cref="T:System.Security.Cryptography.OidCollection" /> object.</summary>
|
||||
/// <returns>An object that can be used to synchronize access to the <see cref="T:System.Security.Cryptography.OidCollection" /> object.</returns>
|
||||
// Token: 0x170007C9 RID: 1993
|
||||
// (get) Token: 0x060018DA RID: 6362 RVA: 0x000553F4 File Offset: 0x000535F4
|
||||
public object SyncRoot
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._list.SyncRoot;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Adds an <see cref="T:System.Security.Cryptography.Oid" /> object to the <see cref="T:System.Security.Cryptography.OidCollection" /> object.</summary>
|
||||
/// <returns>The index of the added <see cref="T:System.Security.Cryptography.Oid" /> object.</returns>
|
||||
/// <param name="oid">The <see cref="T:System.Security.Cryptography.Oid" /> object to add to the collection.</param>
|
||||
// Token: 0x060018DB RID: 6363 RVA: 0x00055404 File Offset: 0x00053604
|
||||
public int Add(Oid oid)
|
||||
{
|
||||
return (!this._readOnly) ? this._list.Add(oid) : 0;
|
||||
}
|
||||
|
||||
/// <summary>Copies the <see cref="T:System.Security.Cryptography.OidCollection" /> object into an array.</summary>
|
||||
/// <param name="array">The array to copy the <see cref="T:System.Security.Cryptography.OidCollection" /> object into.</param>
|
||||
/// <param name="index">The location where the copy operation starts.</param>
|
||||
// Token: 0x060018DC RID: 6364 RVA: 0x00055424 File Offset: 0x00053624
|
||||
public void CopyTo(Oid[] array, int index)
|
||||
{
|
||||
this._list.CopyTo(array, index);
|
||||
}
|
||||
|
||||
/// <summary>Returns an <see cref="T:System.Security.Cryptography.OidEnumerator" /> object that can be used to navigate the <see cref="T:System.Security.Cryptography.OidCollection" /> object.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.OidEnumerator" /> object.</returns>
|
||||
// Token: 0x060018DD RID: 6365 RVA: 0x00055434 File Offset: 0x00053634
|
||||
public OidEnumerator GetEnumerator()
|
||||
{
|
||||
return new OidEnumerator(this);
|
||||
}
|
||||
|
||||
// Token: 0x170007CA RID: 1994
|
||||
// (get) Token: 0x060018DE RID: 6366 RVA: 0x0005543C File Offset: 0x0005363C
|
||||
// (set) Token: 0x060018DF RID: 6367 RVA: 0x00055444 File Offset: 0x00053644
|
||||
internal bool ReadOnly
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._readOnly;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._readOnly = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060018E0 RID: 6368 RVA: 0x00055450 File Offset: 0x00053650
|
||||
internal OidCollection ReadOnlyCopy()
|
||||
{
|
||||
OidCollection oidCollection = new OidCollection();
|
||||
foreach (object obj in this._list)
|
||||
{
|
||||
Oid oid = (Oid)obj;
|
||||
oidCollection.Add(oid);
|
||||
}
|
||||
oidCollection._readOnly = true;
|
||||
return oidCollection;
|
||||
}
|
||||
|
||||
// Token: 0x040013BD RID: 5053
|
||||
private ArrayList _list;
|
||||
|
||||
// Token: 0x040013BE RID: 5054
|
||||
private bool _readOnly;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace System.Security.Cryptography
|
||||
{
|
||||
/// <summary>Provides the ability to navigate through an <see cref="T:System.Security.Cryptography.OidCollection" /> object. This class cannot be inherited.</summary>
|
||||
// Token: 0x020002A9 RID: 681
|
||||
public sealed class OidEnumerator : IEnumerator
|
||||
{
|
||||
// Token: 0x060018E1 RID: 6369 RVA: 0x000554D0 File Offset: 0x000536D0
|
||||
internal OidEnumerator(OidCollection collection)
|
||||
{
|
||||
this._collection = collection;
|
||||
this._position = -1;
|
||||
}
|
||||
|
||||
/// <summary>Gets the current <see cref="T:System.Security.Cryptography.Oid" /> object in an <see cref="T:System.Security.Cryptography.OidCollection" /> object.</summary>
|
||||
/// <returns>The current <see cref="T:System.Security.Cryptography.Oid" /> object.</returns>
|
||||
// Token: 0x170007CB RID: 1995
|
||||
// (get) Token: 0x060018E2 RID: 6370 RVA: 0x000554E8 File Offset: 0x000536E8
|
||||
object IEnumerator.Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._position < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
return this._collection[this._position];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the current <see cref="T:System.Security.Cryptography.Oid" /> object in an <see cref="T:System.Security.Cryptography.OidCollection" /> object.</summary>
|
||||
/// <returns>The current <see cref="T:System.Security.Cryptography.Oid" /> object in the collection.</returns>
|
||||
// Token: 0x170007CC RID: 1996
|
||||
// (get) Token: 0x060018E3 RID: 6371 RVA: 0x00055510 File Offset: 0x00053710
|
||||
public Oid Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._position < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
return this._collection[this._position];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Advances to the next <see cref="T:System.Security.Cryptography.Oid" /> object in an <see cref="T:System.Security.Cryptography.OidCollection" /> object.</summary>
|
||||
/// <returns>true, if the enumerator was successfully advanced to the next element; false, if the enumerator has passed the end of the collection.</returns>
|
||||
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created.</exception>
|
||||
// Token: 0x060018E4 RID: 6372 RVA: 0x00055538 File Offset: 0x00053738
|
||||
public bool MoveNext()
|
||||
{
|
||||
if (++this._position < this._collection.Count)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
this._position = this._collection.Count - 1;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>Sets an enumerator to its initial position.</summary>
|
||||
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created.</exception>
|
||||
// Token: 0x060018E5 RID: 6373 RVA: 0x0005557C File Offset: 0x0005377C
|
||||
public void Reset()
|
||||
{
|
||||
this._position = -1;
|
||||
}
|
||||
|
||||
// Token: 0x040013BF RID: 5055
|
||||
private OidCollection _collection;
|
||||
|
||||
// Token: 0x040013C0 RID: 5056
|
||||
private int _position;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Specifies the way to open the X.509 certificate store.</summary>
|
||||
// Token: 0x02000281 RID: 641
|
||||
[Flags]
|
||||
public enum OpenFlags
|
||||
{
|
||||
/// <summary>Open the X.509 certificate store for reading only.</summary>
|
||||
// Token: 0x040012CD RID: 4813
|
||||
ReadOnly = 0,
|
||||
/// <summary>Open the X.509 certificate store for both reading and writing.</summary>
|
||||
// Token: 0x040012CE RID: 4814
|
||||
ReadWrite = 1,
|
||||
/// <summary>Open the X.509 certificate store for the highest access allowed.</summary>
|
||||
// Token: 0x040012CF RID: 4815
|
||||
MaxAllowed = 2,
|
||||
/// <summary>Opens only existing stores; if no store exists, the <see cref="M:System.Security.Cryptography.X509Certificates.X509Store.Open(System.Security.Cryptography.X509Certificates.OpenFlags)" /> method will not create a new store.</summary>
|
||||
// Token: 0x040012D0 RID: 4816
|
||||
OpenExistingOnly = 4,
|
||||
/// <summary>Open the X.509 certificate store and include archived certificates.</summary>
|
||||
// Token: 0x040012D1 RID: 4817
|
||||
IncludeArchived = 8
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,267 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Mono.Security;
|
||||
using Mono.Security.Cryptography;
|
||||
using Mono.Security.X509;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Represents a certificate's public key information. This class cannot be inherited.</summary>
|
||||
// Token: 0x02000282 RID: 642
|
||||
public sealed class PublicKey
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.PublicKey" /> class using an object identifier (OID) object of the public key, an ASN.1-encoded representation of the public key parameters, and an ASN.1-encoded representation of the public key value. </summary>
|
||||
/// <param name="oid">An object identifier (OID) object that represents the public key.</param>
|
||||
/// <param name="parameters">An ASN.1-encoded representation of the public key parameters.</param>
|
||||
/// <param name="keyValue">An ASN.1-encoded representation of the public key value.</param>
|
||||
// Token: 0x0600177E RID: 6014 RVA: 0x0004E400 File Offset: 0x0004C600
|
||||
public PublicKey(Oid oid, AsnEncodedData parameters, AsnEncodedData keyValue)
|
||||
{
|
||||
if (oid == null)
|
||||
{
|
||||
throw new ArgumentNullException("oid");
|
||||
}
|
||||
if (parameters == null)
|
||||
{
|
||||
throw new ArgumentNullException("parameters");
|
||||
}
|
||||
if (keyValue == null)
|
||||
{
|
||||
throw new ArgumentNullException("keyValue");
|
||||
}
|
||||
this._oid = new Oid(oid);
|
||||
this._params = new AsnEncodedData(parameters);
|
||||
this._keyValue = new AsnEncodedData(keyValue);
|
||||
}
|
||||
|
||||
// Token: 0x0600177F RID: 6015 RVA: 0x0004E46C File Offset: 0x0004C66C
|
||||
internal PublicKey(X509Certificate certificate)
|
||||
{
|
||||
bool flag = true;
|
||||
if (certificate.KeyAlgorithm == "1.2.840.113549.1.1.1")
|
||||
{
|
||||
RSACryptoServiceProvider rsacryptoServiceProvider = certificate.RSA as RSACryptoServiceProvider;
|
||||
if (rsacryptoServiceProvider != null && rsacryptoServiceProvider.PublicOnly)
|
||||
{
|
||||
this._key = certificate.RSA;
|
||||
flag = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
RSAManaged rsamanaged = certificate.RSA as RSAManaged;
|
||||
if (rsamanaged != null && rsamanaged.PublicOnly)
|
||||
{
|
||||
this._key = certificate.RSA;
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
RSAParameters rsaparameters = certificate.RSA.ExportParameters(false);
|
||||
this._key = RSA.Create();
|
||||
(this._key as RSA).ImportParameters(rsaparameters);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DSACryptoServiceProvider dsacryptoServiceProvider = certificate.DSA as DSACryptoServiceProvider;
|
||||
if (dsacryptoServiceProvider != null && dsacryptoServiceProvider.PublicOnly)
|
||||
{
|
||||
this._key = certificate.DSA;
|
||||
flag = false;
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
DSAParameters dsaparameters = certificate.DSA.ExportParameters(false);
|
||||
this._key = DSA.Create();
|
||||
(this._key as DSA).ImportParameters(dsaparameters);
|
||||
}
|
||||
}
|
||||
this._oid = new Oid(certificate.KeyAlgorithm);
|
||||
this._keyValue = new AsnEncodedData(this._oid, certificate.PublicKey);
|
||||
this._params = new AsnEncodedData(this._oid, certificate.KeyAlgorithmParameters);
|
||||
}
|
||||
|
||||
/// <summary>Gets the ASN.1-encoded representation of the public key value.</summary>
|
||||
/// <returns>The ASN.1-encoded representation of the public key value.</returns>
|
||||
// Token: 0x1700076F RID: 1903
|
||||
// (get) Token: 0x06001780 RID: 6016 RVA: 0x0004E5C4 File Offset: 0x0004C7C4
|
||||
public AsnEncodedData EncodedKeyValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._keyValue;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the ASN.1-encoded representation of the public key parameters.</summary>
|
||||
/// <returns>The ASN.1-encoded representation of the public key parameters.</returns>
|
||||
// Token: 0x17000770 RID: 1904
|
||||
// (get) Token: 0x06001781 RID: 6017 RVA: 0x0004E5CC File Offset: 0x0004C7CC
|
||||
public AsnEncodedData EncodedParameters
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._params;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets an <see cref="T:System.Security.Cryptography.RSACryptoServiceProvider" /> or <see cref="T:System.Security.Cryptography.DSACryptoServiceProvider" /> object representing the public key.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.AsymmetricAlgorithm" /> object representing the public key.</returns>
|
||||
/// <exception cref="T:System.NotSupportedException">The key algorithm is not supported.</exception>
|
||||
// Token: 0x17000771 RID: 1905
|
||||
// (get) Token: 0x06001782 RID: 6018 RVA: 0x0004E5D4 File Offset: 0x0004C7D4
|
||||
public AsymmetricAlgorithm Key
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._key == null)
|
||||
{
|
||||
string value = this._oid.Value;
|
||||
if (value != null)
|
||||
{
|
||||
if (PublicKey.<>f__switch$map9 == null)
|
||||
{
|
||||
PublicKey.<>f__switch$map9 = new Dictionary<string, int>(2)
|
||||
{
|
||||
{ "1.2.840.113549.1.1.1", 0 },
|
||||
{ "1.2.840.10040.4.1", 1 }
|
||||
};
|
||||
}
|
||||
int num;
|
||||
if (PublicKey.<>f__switch$map9.TryGetValue(value, out num))
|
||||
{
|
||||
if (num == 0)
|
||||
{
|
||||
this._key = PublicKey.DecodeRSA(this._keyValue.RawData);
|
||||
goto IL_D7;
|
||||
}
|
||||
if (num == 1)
|
||||
{
|
||||
this._key = PublicKey.DecodeDSA(this._keyValue.RawData, this._params.RawData);
|
||||
goto IL_D7;
|
||||
}
|
||||
}
|
||||
}
|
||||
string text = global::Locale.GetText("Cannot decode public key from unknown OID '{0}'.", new object[] { this._oid.Value });
|
||||
throw new NotSupportedException(text);
|
||||
}
|
||||
IL_D7:
|
||||
return this._key;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets an object identifier (OID) object of the public key.</summary>
|
||||
/// <returns>An object identifier (OID) object of the public key.</returns>
|
||||
// Token: 0x17000772 RID: 1906
|
||||
// (get) Token: 0x06001783 RID: 6019 RVA: 0x0004E6C0 File Offset: 0x0004C8C0
|
||||
public Oid Oid
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._oid;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001784 RID: 6020 RVA: 0x0004E6C8 File Offset: 0x0004C8C8
|
||||
private static byte[] GetUnsignedBigInteger(byte[] integer)
|
||||
{
|
||||
if (integer[0] != 0)
|
||||
{
|
||||
return integer;
|
||||
}
|
||||
int num = integer.Length - 1;
|
||||
byte[] array = new byte[num];
|
||||
Buffer.BlockCopy(integer, 1, array, 0, num);
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x06001785 RID: 6021 RVA: 0x0004E6F8 File Offset: 0x0004C8F8
|
||||
internal static DSA DecodeDSA(byte[] rawPublicKey, byte[] rawParameters)
|
||||
{
|
||||
DSAParameters dsaparameters = default(DSAParameters);
|
||||
try
|
||||
{
|
||||
ASN1 asn = new ASN1(rawPublicKey);
|
||||
if (asn.Tag != 2)
|
||||
{
|
||||
throw new CryptographicException(global::Locale.GetText("Missing DSA Y integer."));
|
||||
}
|
||||
dsaparameters.Y = PublicKey.GetUnsignedBigInteger(asn.Value);
|
||||
ASN1 asn2 = new ASN1(rawParameters);
|
||||
if (asn2 == null || asn2.Tag != 48 || asn2.Count < 3)
|
||||
{
|
||||
throw new CryptographicException(global::Locale.GetText("Missing DSA parameters."));
|
||||
}
|
||||
if (asn2[0].Tag != 2 || asn2[1].Tag != 2 || asn2[2].Tag != 2)
|
||||
{
|
||||
throw new CryptographicException(global::Locale.GetText("Invalid DSA parameters."));
|
||||
}
|
||||
dsaparameters.P = PublicKey.GetUnsignedBigInteger(asn2[0].Value);
|
||||
dsaparameters.Q = PublicKey.GetUnsignedBigInteger(asn2[1].Value);
|
||||
dsaparameters.G = PublicKey.GetUnsignedBigInteger(asn2[2].Value);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string text = global::Locale.GetText("Error decoding the ASN.1 structure.");
|
||||
throw new CryptographicException(text, ex);
|
||||
}
|
||||
DSA dsa = new DSACryptoServiceProvider(dsaparameters.Y.Length << 3);
|
||||
dsa.ImportParameters(dsaparameters);
|
||||
return dsa;
|
||||
}
|
||||
|
||||
// Token: 0x06001786 RID: 6022 RVA: 0x0004E860 File Offset: 0x0004CA60
|
||||
internal static RSA DecodeRSA(byte[] rawPublicKey)
|
||||
{
|
||||
RSAParameters rsaparameters = default(RSAParameters);
|
||||
try
|
||||
{
|
||||
ASN1 asn = new ASN1(rawPublicKey);
|
||||
if (asn.Count == 0)
|
||||
{
|
||||
throw new CryptographicException(global::Locale.GetText("Missing RSA modulus and exponent."));
|
||||
}
|
||||
ASN1 asn2 = asn[0];
|
||||
if (asn2 == null || asn2.Tag != 2)
|
||||
{
|
||||
throw new CryptographicException(global::Locale.GetText("Missing RSA modulus."));
|
||||
}
|
||||
ASN1 asn3 = asn[1];
|
||||
if (asn3.Tag != 2)
|
||||
{
|
||||
throw new CryptographicException(global::Locale.GetText("Missing RSA public exponent."));
|
||||
}
|
||||
rsaparameters.Modulus = PublicKey.GetUnsignedBigInteger(asn2.Value);
|
||||
rsaparameters.Exponent = asn3.Value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string text = global::Locale.GetText("Error decoding the ASN.1 structure.");
|
||||
throw new CryptographicException(text, ex);
|
||||
}
|
||||
int num = rsaparameters.Modulus.Length << 3;
|
||||
RSA rsa = new RSACryptoServiceProvider(num);
|
||||
rsa.ImportParameters(rsaparameters);
|
||||
return rsa;
|
||||
}
|
||||
|
||||
// Token: 0x040012D2 RID: 4818
|
||||
private const string rsaOid = "1.2.840.113549.1.1.1";
|
||||
|
||||
// Token: 0x040012D3 RID: 4819
|
||||
private const string dsaOid = "1.2.840.10040.4.1";
|
||||
|
||||
// Token: 0x040012D4 RID: 4820
|
||||
private AsymmetricAlgorithm _key;
|
||||
|
||||
// Token: 0x040012D5 RID: 4821
|
||||
private AsnEncodedData _keyValue;
|
||||
|
||||
// Token: 0x040012D6 RID: 4822
|
||||
private AsnEncodedData _params;
|
||||
|
||||
// Token: 0x040012D7 RID: 4823
|
||||
private Oid _oid;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Specifies the location of the X.509 certificate store.</summary>
|
||||
// Token: 0x02000283 RID: 643
|
||||
public enum StoreLocation
|
||||
{
|
||||
/// <summary>The X.509 certificate store used by the current user.</summary>
|
||||
// Token: 0x040012DA RID: 4826
|
||||
CurrentUser = 1,
|
||||
/// <summary>The X.509 certificate store assigned to the local machine.</summary>
|
||||
// Token: 0x040012DB RID: 4827
|
||||
LocalMachine
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Specifies the name of the X.509 certificate store to open.</summary>
|
||||
// Token: 0x02000284 RID: 644
|
||||
public enum StoreName
|
||||
{
|
||||
/// <summary>The X.509 certificate store for other users.</summary>
|
||||
// Token: 0x040012DD RID: 4829
|
||||
AddressBook = 1,
|
||||
/// <summary>The X.509 certificate store for third-party certificate authorities (CAs).</summary>
|
||||
// Token: 0x040012DE RID: 4830
|
||||
AuthRoot,
|
||||
/// <summary>The X.509 certificate store for intermediate certificate authorities (CAs). </summary>
|
||||
// Token: 0x040012DF RID: 4831
|
||||
CertificateAuthority,
|
||||
/// <summary>The X.509 certificate store for revoked certificates.</summary>
|
||||
// Token: 0x040012E0 RID: 4832
|
||||
Disallowed,
|
||||
/// <summary>The X.509 certificate store for personal certificates.</summary>
|
||||
// Token: 0x040012E1 RID: 4833
|
||||
My,
|
||||
/// <summary>The X.509 certificate store for trusted root certificate authorities (CAs).</summary>
|
||||
// Token: 0x040012E2 RID: 4834
|
||||
Root,
|
||||
/// <summary>The X.509 certificate store for directly trusted people and resources.</summary>
|
||||
// Token: 0x040012E3 RID: 4835
|
||||
TrustedPeople,
|
||||
/// <summary>The X.509 certificate store for directly trusted publishers.</summary>
|
||||
// Token: 0x040012E4 RID: 4836
|
||||
TrustedPublisher
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,274 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using Mono.Security;
|
||||
using Mono.Security.X509;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Represents the distinguished name of an X509 certificate. This class cannot be inherited.</summary>
|
||||
// Token: 0x02000285 RID: 645
|
||||
[global::System.MonoTODO("Some X500DistinguishedNameFlags options aren't supported, like DoNotUsePlusSign, DoNotUseQuotes and ForceUTF8Encoding")]
|
||||
public sealed class X500DistinguishedName : AsnEncodedData
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X500DistinguishedName" /> class using the specified <see cref="T:System.Security.Cryptography.AsnEncodedData" /> object.</summary>
|
||||
/// <param name="encodedDistinguishedName">An <see cref="T:System.Security.Cryptography.AsnEncodedData" /> object that represents the distinguished name.</param>
|
||||
// Token: 0x06001787 RID: 6023 RVA: 0x0004E964 File Offset: 0x0004CB64
|
||||
public X500DistinguishedName(AsnEncodedData encodedDistinguishedName)
|
||||
{
|
||||
if (encodedDistinguishedName == null)
|
||||
{
|
||||
throw new ArgumentNullException("encodedDistinguishedName");
|
||||
}
|
||||
base.RawData = encodedDistinguishedName.RawData;
|
||||
if (base.RawData.Length > 0)
|
||||
{
|
||||
this.DecodeRawData();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.name = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X500DistinguishedName" /> class using information from the specified byte array.</summary>
|
||||
/// <param name="encodedDistinguishedName">A byte array that contains distinguished name information.</param>
|
||||
// Token: 0x06001788 RID: 6024 RVA: 0x0004E9B8 File Offset: 0x0004CBB8
|
||||
public X500DistinguishedName(byte[] encodedDistinguishedName)
|
||||
{
|
||||
if (encodedDistinguishedName == null)
|
||||
{
|
||||
throw new ArgumentNullException("encodedDistinguishedName");
|
||||
}
|
||||
base.Oid = new Oid();
|
||||
base.RawData = encodedDistinguishedName;
|
||||
if (encodedDistinguishedName.Length > 0)
|
||||
{
|
||||
this.DecodeRawData();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.name = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X500DistinguishedName" /> class using information from the specified string.</summary>
|
||||
/// <param name="distinguishedName">A string that represents the distinguished name.</param>
|
||||
// Token: 0x06001789 RID: 6025 RVA: 0x0004EA10 File Offset: 0x0004CC10
|
||||
public X500DistinguishedName(string distinguishedName)
|
||||
: this(distinguishedName, X500DistinguishedNameFlags.Reversed)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X500DistinguishedName" /> class using the specified string and <see cref="T:System.Security.Cryptography.X509Certificates.X500DistinguishedNameFlags" /> flag.</summary>
|
||||
/// <param name="distinguishedName">A string that represents the distinguished name.</param>
|
||||
/// <param name="flag">An <see cref="T:System.Security.Cryptography.X509Certificates.X500DistinguishedName" /> object that specifies the characteristics of the distinguished name.</param>
|
||||
// Token: 0x0600178A RID: 6026 RVA: 0x0004EA1C File Offset: 0x0004CC1C
|
||||
public X500DistinguishedName(string distinguishedName, X500DistinguishedNameFlags flag)
|
||||
{
|
||||
if (distinguishedName == null)
|
||||
{
|
||||
throw new ArgumentNullException("distinguishedName");
|
||||
}
|
||||
if (flag != X500DistinguishedNameFlags.None && (flag & (X500DistinguishedNameFlags.Reversed | X500DistinguishedNameFlags.UseSemicolons | X500DistinguishedNameFlags.DoNotUsePlusSign | X500DistinguishedNameFlags.DoNotUseQuotes | X500DistinguishedNameFlags.UseCommas | X500DistinguishedNameFlags.UseNewLines | X500DistinguishedNameFlags.UseUTF8Encoding | X500DistinguishedNameFlags.UseT61Encoding | X500DistinguishedNameFlags.ForceUTF8Encoding)) == X500DistinguishedNameFlags.None)
|
||||
{
|
||||
throw new ArgumentException("flag");
|
||||
}
|
||||
base.Oid = new Oid();
|
||||
if (distinguishedName.Length == 0)
|
||||
{
|
||||
byte[] array = new byte[2];
|
||||
array[0] = 48;
|
||||
base.RawData = array;
|
||||
this.DecodeRawData();
|
||||
}
|
||||
else
|
||||
{
|
||||
ASN1 asn = X501.FromString(distinguishedName);
|
||||
if ((flag & X500DistinguishedNameFlags.Reversed) != X500DistinguishedNameFlags.None)
|
||||
{
|
||||
ASN1 asn2 = new ASN1(48);
|
||||
for (int i = asn.Count - 1; i >= 0; i--)
|
||||
{
|
||||
asn2.Add(asn[i]);
|
||||
}
|
||||
asn = asn2;
|
||||
}
|
||||
base.RawData = asn.GetBytes();
|
||||
if (flag == X500DistinguishedNameFlags.None)
|
||||
{
|
||||
this.name = distinguishedName;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.name = this.Decode(flag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X500DistinguishedName" /> class using the specified <see cref="T:System.Security.Cryptography.X509Certificates.X500DistinguishedName" /> object.</summary>
|
||||
/// <param name="distinguishedName">An <see cref="T:System.Security.Cryptography.X509Certificates.X500DistinguishedName" /> object.</param>
|
||||
// Token: 0x0600178B RID: 6027 RVA: 0x0004EAFC File Offset: 0x0004CCFC
|
||||
public X500DistinguishedName(X500DistinguishedName distinguishedName)
|
||||
{
|
||||
if (distinguishedName == null)
|
||||
{
|
||||
throw new ArgumentNullException("distinguishedName");
|
||||
}
|
||||
base.Oid = new Oid();
|
||||
base.RawData = distinguishedName.RawData;
|
||||
this.name = distinguishedName.name;
|
||||
}
|
||||
|
||||
/// <summary>Gets the comma-delimited distinguished name from an X500 certificate.</summary>
|
||||
/// <returns>The comma-delimited distinguished name of the X509 certificate.</returns>
|
||||
// Token: 0x17000773 RID: 1907
|
||||
// (get) Token: 0x0600178C RID: 6028 RVA: 0x0004EB44 File Offset: 0x0004CD44
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Decodes a distinguished name using the characteristics specified by the <paramref name="flag" /> parameter.</summary>
|
||||
/// <returns>The decoded distinguished name.</returns>
|
||||
/// <param name="flag">A flag that specifies the characteristics of the <see cref="T:System.Security.Cryptography.X509Certificates.X500DistinguishedName" /> object.</param>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The certificate has an invalid name.</exception>
|
||||
// Token: 0x0600178D RID: 6029 RVA: 0x0004EB4C File Offset: 0x0004CD4C
|
||||
public string Decode(X500DistinguishedNameFlags flag)
|
||||
{
|
||||
if (flag != X500DistinguishedNameFlags.None && (flag & (X500DistinguishedNameFlags.Reversed | X500DistinguishedNameFlags.UseSemicolons | X500DistinguishedNameFlags.DoNotUsePlusSign | X500DistinguishedNameFlags.DoNotUseQuotes | X500DistinguishedNameFlags.UseCommas | X500DistinguishedNameFlags.UseNewLines | X500DistinguishedNameFlags.UseUTF8Encoding | X500DistinguishedNameFlags.UseT61Encoding | X500DistinguishedNameFlags.ForceUTF8Encoding)) == X500DistinguishedNameFlags.None)
|
||||
{
|
||||
throw new ArgumentException("flag");
|
||||
}
|
||||
if (base.RawData.Length == 0)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
bool flag2 = (flag & X500DistinguishedNameFlags.Reversed) != X500DistinguishedNameFlags.None;
|
||||
bool flag3 = (flag & X500DistinguishedNameFlags.DoNotUseQuotes) == X500DistinguishedNameFlags.None;
|
||||
string separator = X500DistinguishedName.GetSeparator(flag);
|
||||
ASN1 asn = new ASN1(base.RawData);
|
||||
return X501.ToString(asn, flag2, separator, flag3);
|
||||
}
|
||||
|
||||
/// <summary>Returns a formatted version of an X500 distinguished name for printing or for output to a text window or to a console.</summary>
|
||||
/// <returns>A formatted string that represents the X500 distinguished name.</returns>
|
||||
/// <param name="multiLine">true if the return string should contain carriage returns; otherwise, false.</param>
|
||||
// Token: 0x0600178E RID: 6030 RVA: 0x0004EBB8 File Offset: 0x0004CDB8
|
||||
public override string Format(bool multiLine)
|
||||
{
|
||||
if (!multiLine)
|
||||
{
|
||||
return this.Decode(X500DistinguishedNameFlags.UseCommas);
|
||||
}
|
||||
string text = this.Decode(X500DistinguishedNameFlags.UseNewLines);
|
||||
if (text.Length > 0)
|
||||
{
|
||||
return text + Environment.NewLine;
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
// Token: 0x0600178F RID: 6031 RVA: 0x0004EBFC File Offset: 0x0004CDFC
|
||||
private static string GetSeparator(X500DistinguishedNameFlags flag)
|
||||
{
|
||||
if ((flag & X500DistinguishedNameFlags.UseSemicolons) != X500DistinguishedNameFlags.None)
|
||||
{
|
||||
return "; ";
|
||||
}
|
||||
if ((flag & X500DistinguishedNameFlags.UseCommas) != X500DistinguishedNameFlags.None)
|
||||
{
|
||||
return ", ";
|
||||
}
|
||||
if ((flag & X500DistinguishedNameFlags.UseNewLines) != X500DistinguishedNameFlags.None)
|
||||
{
|
||||
return Environment.NewLine;
|
||||
}
|
||||
return ", ";
|
||||
}
|
||||
|
||||
// Token: 0x06001790 RID: 6032 RVA: 0x0004EC44 File Offset: 0x0004CE44
|
||||
private void DecodeRawData()
|
||||
{
|
||||
if (base.RawData == null || base.RawData.Length < 3)
|
||||
{
|
||||
this.name = string.Empty;
|
||||
return;
|
||||
}
|
||||
ASN1 asn = new ASN1(base.RawData);
|
||||
this.name = X501.ToString(asn, true, ", ", true);
|
||||
}
|
||||
|
||||
// Token: 0x06001791 RID: 6033 RVA: 0x0004EC98 File Offset: 0x0004CE98
|
||||
private static string Canonize(string s)
|
||||
{
|
||||
int i = s.IndexOf('=');
|
||||
StringBuilder stringBuilder = new StringBuilder(s.Substring(0, i + 1));
|
||||
while (char.IsWhiteSpace(s, ++i))
|
||||
{
|
||||
}
|
||||
s = s.TrimEnd(new char[0]);
|
||||
bool flag = false;
|
||||
while (i < s.Length)
|
||||
{
|
||||
if (!flag)
|
||||
{
|
||||
goto IL_5C;
|
||||
}
|
||||
flag = char.IsWhiteSpace(s, i);
|
||||
if (!flag)
|
||||
{
|
||||
goto IL_5C;
|
||||
}
|
||||
IL_7D:
|
||||
i++;
|
||||
continue;
|
||||
IL_5C:
|
||||
if (char.IsWhiteSpace(s, i))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
stringBuilder.Append(char.ToUpperInvariant(s[i]));
|
||||
goto IL_7D;
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
// Token: 0x06001792 RID: 6034 RVA: 0x0004ED38 File Offset: 0x0004CF38
|
||||
internal static bool AreEqual(X500DistinguishedName name1, X500DistinguishedName name2)
|
||||
{
|
||||
if (name1 == null)
|
||||
{
|
||||
return name2 == null;
|
||||
}
|
||||
if (name2 == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
X500DistinguishedNameFlags x500DistinguishedNameFlags = X500DistinguishedNameFlags.DoNotUseQuotes | X500DistinguishedNameFlags.UseNewLines;
|
||||
string[] array = new string[] { Environment.NewLine };
|
||||
string[] array2 = name1.Decode(x500DistinguishedNameFlags).Split(array, StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] array3 = name2.Decode(x500DistinguishedNameFlags).Split(array, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (array2.Length != array3.Length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < array2.Length; i++)
|
||||
{
|
||||
if (X500DistinguishedName.Canonize(array2[i]) != X500DistinguishedName.Canonize(array3[i]))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x040012E5 RID: 4837
|
||||
private const X500DistinguishedNameFlags AllFlags = X500DistinguishedNameFlags.Reversed | X500DistinguishedNameFlags.UseSemicolons | X500DistinguishedNameFlags.DoNotUsePlusSign | X500DistinguishedNameFlags.DoNotUseQuotes | X500DistinguishedNameFlags.UseCommas | X500DistinguishedNameFlags.UseNewLines | X500DistinguishedNameFlags.UseUTF8Encoding | X500DistinguishedNameFlags.UseT61Encoding | X500DistinguishedNameFlags.ForceUTF8Encoding;
|
||||
|
||||
// Token: 0x040012E6 RID: 4838
|
||||
private string name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Specifies characteristics of the X.500 distinguished name.</summary>
|
||||
// Token: 0x02000286 RID: 646
|
||||
[Flags]
|
||||
public enum X500DistinguishedNameFlags
|
||||
{
|
||||
/// <summary>The distinguished name has no special characteristics.</summary>
|
||||
// Token: 0x040012E8 RID: 4840
|
||||
None = 0,
|
||||
/// <summary>The distinguished name is reversed.</summary>
|
||||
// Token: 0x040012E9 RID: 4841
|
||||
Reversed = 1,
|
||||
/// <summary>The distinguished name uses semicolons.</summary>
|
||||
// Token: 0x040012EA RID: 4842
|
||||
UseSemicolons = 16,
|
||||
/// <summary>The distinguished name does not use the plus sign.</summary>
|
||||
// Token: 0x040012EB RID: 4843
|
||||
DoNotUsePlusSign = 32,
|
||||
/// <summary>The distinguished name does not use quotation marks.</summary>
|
||||
// Token: 0x040012EC RID: 4844
|
||||
DoNotUseQuotes = 64,
|
||||
/// <summary>The distinguished name uses commas.</summary>
|
||||
// Token: 0x040012ED RID: 4845
|
||||
UseCommas = 128,
|
||||
/// <summary>The distinguished name uses the new line character.</summary>
|
||||
// Token: 0x040012EE RID: 4846
|
||||
UseNewLines = 256,
|
||||
/// <summary>The distinguished name uses UTF8 encoding.</summary>
|
||||
// Token: 0x040012EF RID: 4847
|
||||
UseUTF8Encoding = 4096,
|
||||
/// <summary>The distinguished name uses T61 encoding.</summary>
|
||||
// Token: 0x040012F0 RID: 4848
|
||||
UseT61Encoding = 8192,
|
||||
/// <summary>The distinguished name uses UTF8 encoding.</summary>
|
||||
// Token: 0x040012F1 RID: 4849
|
||||
ForceUTF8Encoding = 16384
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,265 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using Mono.Security;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Defines the constraints set on a certificate. This class cannot be inherited.</summary>
|
||||
// Token: 0x02000287 RID: 647
|
||||
public sealed class X509BasicConstraintsExtension : X509Extension
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509BasicConstraintsExtension" /> class.</summary>
|
||||
// Token: 0x06001793 RID: 6035 RVA: 0x0004EDD0 File Offset: 0x0004CFD0
|
||||
public X509BasicConstraintsExtension()
|
||||
{
|
||||
this._oid = new Oid("2.5.29.19", "Basic Constraints");
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509BasicConstraintsExtension" /> class using an <see cref="T:System.Security.Cryptography.AsnEncodedData" /> object and a value that identifies whether the extension is critical. </summary>
|
||||
/// <param name="encodedBasicConstraints">The encoded data to use to create the extension.</param>
|
||||
/// <param name="critical">true if the extension is critical; otherwise, false.</param>
|
||||
// Token: 0x06001794 RID: 6036 RVA: 0x0004EDF0 File Offset: 0x0004CFF0
|
||||
public X509BasicConstraintsExtension(AsnEncodedData encodedBasicConstraints, bool critical)
|
||||
{
|
||||
this._oid = new Oid("2.5.29.19", "Basic Constraints");
|
||||
this._raw = encodedBasicConstraints.RawData;
|
||||
base.Critical = critical;
|
||||
this._status = this.Decode(base.RawData);
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509BasicConstraintsExtension" /> class. Parameters specify a value that indicates whether a certificate is a certificate authority (CA) certificate, a value that indicates whether the certificate has a restriction on the number of path levels it allows, the number of levels allowed in a certificate's path, and a value that indicates whether the extension is critical. </summary>
|
||||
/// <param name="certificateAuthority">true if the certificate is a certificate authority (CA) certificate; otherwise, false.</param>
|
||||
/// <param name="hasPathLengthConstraint">true if the certificate has a restriction on the number of path levels it allows; otherwise, false.</param>
|
||||
/// <param name="pathLengthConstraint">The number of levels allowed in a certificate's path.</param>
|
||||
/// <param name="critical">true if the extension is critical; otherwise, false.</param>
|
||||
// Token: 0x06001795 RID: 6037 RVA: 0x0004EE40 File Offset: 0x0004D040
|
||||
public X509BasicConstraintsExtension(bool certificateAuthority, bool hasPathLengthConstraint, int pathLengthConstraint, bool critical)
|
||||
{
|
||||
if (hasPathLengthConstraint)
|
||||
{
|
||||
if (pathLengthConstraint < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("pathLengthConstraint");
|
||||
}
|
||||
this._pathLengthConstraint = pathLengthConstraint;
|
||||
}
|
||||
this._hasPathLengthConstraint = hasPathLengthConstraint;
|
||||
this._certificateAuthority = certificateAuthority;
|
||||
this._oid = new Oid("2.5.29.19", "Basic Constraints");
|
||||
base.Critical = critical;
|
||||
base.RawData = this.Encode();
|
||||
}
|
||||
|
||||
/// <summary>Gets a value indicating whether a certificate is a certificate authority (CA) certificate.</summary>
|
||||
/// <returns>true if the certificate is a certificate authority (CA) certificate, otherwise, false.</returns>
|
||||
// Token: 0x17000774 RID: 1908
|
||||
// (get) Token: 0x06001796 RID: 6038 RVA: 0x0004EEAC File Offset: 0x0004D0AC
|
||||
public bool CertificateAuthority
|
||||
{
|
||||
get
|
||||
{
|
||||
AsnDecodeStatus status = this._status;
|
||||
if (status != AsnDecodeStatus.Ok && status != AsnDecodeStatus.InformationNotAvailable)
|
||||
{
|
||||
throw new CryptographicException("Badly encoded extension.");
|
||||
}
|
||||
return this._certificateAuthority;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a value indicating whether a certificate has a restriction on the number of path levels it allows.</summary>
|
||||
/// <returns>true if the certificate has a restriction on the number of path levels it allows, otherwise, false.</returns>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The extension cannot be decoded. </exception>
|
||||
// Token: 0x17000775 RID: 1909
|
||||
// (get) Token: 0x06001797 RID: 6039 RVA: 0x0004EEE4 File Offset: 0x0004D0E4
|
||||
public bool HasPathLengthConstraint
|
||||
{
|
||||
get
|
||||
{
|
||||
AsnDecodeStatus status = this._status;
|
||||
if (status != AsnDecodeStatus.Ok && status != AsnDecodeStatus.InformationNotAvailable)
|
||||
{
|
||||
throw new CryptographicException("Badly encoded extension.");
|
||||
}
|
||||
return this._hasPathLengthConstraint;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the number of levels allowed in a certificate's path.</summary>
|
||||
/// <returns>An integer indicating the number of levels allowed in a certificate's path.</returns>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The extension cannot be decoded. </exception>
|
||||
// Token: 0x17000776 RID: 1910
|
||||
// (get) Token: 0x06001798 RID: 6040 RVA: 0x0004EF1C File Offset: 0x0004D11C
|
||||
public int PathLengthConstraint
|
||||
{
|
||||
get
|
||||
{
|
||||
AsnDecodeStatus status = this._status;
|
||||
if (status != AsnDecodeStatus.Ok && status != AsnDecodeStatus.InformationNotAvailable)
|
||||
{
|
||||
throw new CryptographicException("Badly encoded extension.");
|
||||
}
|
||||
return this._pathLengthConstraint;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509BasicConstraintsExtension" /> class using an <see cref="T:System.Security.Cryptography.AsnEncodedData" /> object.</summary>
|
||||
/// <param name="asnEncodedData">The encoded data to use to create the extension.</param>
|
||||
// Token: 0x06001799 RID: 6041 RVA: 0x0004EF54 File Offset: 0x0004D154
|
||||
public override void CopyFrom(AsnEncodedData asnEncodedData)
|
||||
{
|
||||
if (asnEncodedData == null)
|
||||
{
|
||||
throw new ArgumentNullException("asnEncodedData");
|
||||
}
|
||||
X509Extension x509Extension = asnEncodedData as X509Extension;
|
||||
if (x509Extension == null)
|
||||
{
|
||||
throw new ArgumentException(global::Locale.GetText("Wrong type."), "asnEncodedData");
|
||||
}
|
||||
if (x509Extension._oid == null)
|
||||
{
|
||||
this._oid = new Oid("2.5.29.19", "Basic Constraints");
|
||||
}
|
||||
else
|
||||
{
|
||||
this._oid = new Oid(x509Extension._oid);
|
||||
}
|
||||
base.RawData = x509Extension.RawData;
|
||||
base.Critical = x509Extension.Critical;
|
||||
this._status = this.Decode(base.RawData);
|
||||
}
|
||||
|
||||
// Token: 0x0600179A RID: 6042 RVA: 0x0004EFF4 File Offset: 0x0004D1F4
|
||||
internal AsnDecodeStatus Decode(byte[] extension)
|
||||
{
|
||||
if (extension == null || extension.Length == 0)
|
||||
{
|
||||
return AsnDecodeStatus.BadAsn;
|
||||
}
|
||||
if (extension[0] != 48)
|
||||
{
|
||||
return AsnDecodeStatus.BadTag;
|
||||
}
|
||||
if (extension.Length < 3 && (extension.Length != 2 || extension[1] != 0))
|
||||
{
|
||||
return AsnDecodeStatus.BadLength;
|
||||
}
|
||||
try
|
||||
{
|
||||
ASN1 asn = new ASN1(extension);
|
||||
int num = 0;
|
||||
ASN1 asn2 = asn[num++];
|
||||
if (asn2 != null && asn2.Tag == 1)
|
||||
{
|
||||
this._certificateAuthority = asn2.Value[0] == byte.MaxValue;
|
||||
asn2 = asn[num++];
|
||||
}
|
||||
if (asn2 != null && asn2.Tag == 2)
|
||||
{
|
||||
this._hasPathLengthConstraint = true;
|
||||
this._pathLengthConstraint = ASN1Convert.ToInt32(asn2);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
return AsnDecodeStatus.BadAsn;
|
||||
}
|
||||
return AsnDecodeStatus.Ok;
|
||||
}
|
||||
|
||||
// Token: 0x0600179B RID: 6043 RVA: 0x0004F0D8 File Offset: 0x0004D2D8
|
||||
internal byte[] Encode()
|
||||
{
|
||||
ASN1 asn = new ASN1(48);
|
||||
if (this._certificateAuthority)
|
||||
{
|
||||
asn.Add(new ASN1(1, new byte[] { byte.MaxValue }));
|
||||
}
|
||||
if (this._hasPathLengthConstraint)
|
||||
{
|
||||
if (this._pathLengthConstraint == 0)
|
||||
{
|
||||
asn.Add(new ASN1(2, new byte[1]));
|
||||
}
|
||||
else
|
||||
{
|
||||
asn.Add(ASN1Convert.FromInt32(this._pathLengthConstraint));
|
||||
}
|
||||
}
|
||||
return asn.GetBytes();
|
||||
}
|
||||
|
||||
// Token: 0x0600179C RID: 6044 RVA: 0x0004F15C File Offset: 0x0004D35C
|
||||
internal override string ToString(bool multiLine)
|
||||
{
|
||||
switch (this._status)
|
||||
{
|
||||
case AsnDecodeStatus.BadAsn:
|
||||
return string.Empty;
|
||||
case AsnDecodeStatus.BadTag:
|
||||
case AsnDecodeStatus.BadLength:
|
||||
return base.FormatUnkownData(this._raw);
|
||||
case AsnDecodeStatus.InformationNotAvailable:
|
||||
return "Information Not Available";
|
||||
default:
|
||||
{
|
||||
if (this._oid.Value != "2.5.29.19")
|
||||
{
|
||||
return string.Format("Unknown Key Usage ({0})", this._oid.Value);
|
||||
}
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.Append("Subject Type=");
|
||||
if (this._certificateAuthority)
|
||||
{
|
||||
stringBuilder.Append("CA");
|
||||
}
|
||||
else
|
||||
{
|
||||
stringBuilder.Append("End Entity");
|
||||
}
|
||||
if (multiLine)
|
||||
{
|
||||
stringBuilder.Append(Environment.NewLine);
|
||||
}
|
||||
else
|
||||
{
|
||||
stringBuilder.Append(", ");
|
||||
}
|
||||
stringBuilder.Append("Path Length Constraint=");
|
||||
if (this._hasPathLengthConstraint)
|
||||
{
|
||||
stringBuilder.Append(this._pathLengthConstraint);
|
||||
}
|
||||
else
|
||||
{
|
||||
stringBuilder.Append("None");
|
||||
}
|
||||
if (multiLine)
|
||||
{
|
||||
stringBuilder.Append(Environment.NewLine);
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040012F2 RID: 4850
|
||||
internal const string oid = "2.5.29.19";
|
||||
|
||||
// Token: 0x040012F3 RID: 4851
|
||||
internal const string friendlyName = "Basic Constraints";
|
||||
|
||||
// Token: 0x040012F4 RID: 4852
|
||||
private bool _certificateAuthority;
|
||||
|
||||
// Token: 0x040012F5 RID: 4853
|
||||
private bool _hasPathLengthConstraint;
|
||||
|
||||
// Token: 0x040012F6 RID: 4854
|
||||
private int _pathLengthConstraint;
|
||||
|
||||
// Token: 0x040012F7 RID: 4855
|
||||
private AsnDecodeStatus _status;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,976 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Mono.Security;
|
||||
using Mono.Security.Cryptography;
|
||||
using Mono.Security.X509;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Represents an X.509 certificate. This class can be inherited.</summary>
|
||||
// Token: 0x02000288 RID: 648
|
||||
public class X509Certificate2 : X509Certificate
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> class.</summary>
|
||||
// Token: 0x0600179D RID: 6045 RVA: 0x0004F280 File Offset: 0x0004D480
|
||||
public X509Certificate2()
|
||||
{
|
||||
this._cert = null;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> class using information from a byte array.</summary>
|
||||
/// <param name="rawData">A byte array containing data from an X.509 certificate. </param>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">An error with the certificate occurs. For example:The certificate file does not exist.The certificate is invalid.The certificate's password is incorrect.</exception>
|
||||
// Token: 0x0600179E RID: 6046 RVA: 0x0004F29C File Offset: 0x0004D49C
|
||||
public X509Certificate2(byte[] rawData)
|
||||
{
|
||||
this.Import(rawData, null, X509KeyStorageFlags.DefaultKeySet);
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> class using a byte array and a password.</summary>
|
||||
/// <param name="rawData">A byte array containing data from an X.509 certificate. </param>
|
||||
/// <param name="password">The password required to access the X.509 certificate data. </param>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">An error with the certificate occurs. For example:The certificate file does not exist.The certificate is invalid.The certificate's password is incorrect.</exception>
|
||||
// Token: 0x0600179F RID: 6047 RVA: 0x0004F2B8 File Offset: 0x0004D4B8
|
||||
public X509Certificate2(byte[] rawData, string password)
|
||||
{
|
||||
this.Import(rawData, password, X509KeyStorageFlags.DefaultKeySet);
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> class using a byte array and a password.</summary>
|
||||
/// <param name="rawData">A byte array that contains data from an X.509 certificate. </param>
|
||||
/// <param name="password">The password required to access the X.509 certificate data. </param>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">An error with the certificate occurs. For example:The certificate file does not exist.The certificate is invalid.The certificate's password is incorrect.</exception>
|
||||
// Token: 0x060017A0 RID: 6048 RVA: 0x0004F2D4 File Offset: 0x0004D4D4
|
||||
public X509Certificate2(byte[] rawData, SecureString password)
|
||||
{
|
||||
this.Import(rawData, password, X509KeyStorageFlags.DefaultKeySet);
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> class using a byte array, a password, and a key storage flag.</summary>
|
||||
/// <param name="rawData">A byte array containing data from an X.509 certificate. </param>
|
||||
/// <param name="password">The password required to access the X.509 certificate data. </param>
|
||||
/// <param name="keyStorageFlags">One of the <see cref="T:System.Security.Cryptography.X509Certificates.X509KeyStorageFlags" /> values. </param>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">An error with the certificate occurs. For example:The certificate file does not exist.The certificate is invalid.The certificate's password is incorrect.</exception>
|
||||
// Token: 0x060017A1 RID: 6049 RVA: 0x0004F2F0 File Offset: 0x0004D4F0
|
||||
public X509Certificate2(byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags)
|
||||
{
|
||||
this.Import(rawData, password, keyStorageFlags);
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> class using a byte array, a password, and a key storage flag.</summary>
|
||||
/// <param name="rawData">A byte array that contains data from an X.509 certificate. </param>
|
||||
/// <param name="password">The password required to access the X.509 certificate data. </param>
|
||||
/// <param name="keyStorageFlags">One of the <see cref="T:System.Security.Cryptography.X509Certificates.X509KeyStorageFlags" /> values that controls where and how to import the private key. </param>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">An error with the certificate occurs. For example:The certificate file does not exist.The certificate is invalid.The certificate's password is incorrect.</exception>
|
||||
// Token: 0x060017A2 RID: 6050 RVA: 0x0004F30C File Offset: 0x0004D50C
|
||||
public X509Certificate2(byte[] rawData, SecureString password, X509KeyStorageFlags keyStorageFlags)
|
||||
{
|
||||
this.Import(rawData, password, keyStorageFlags);
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> class using a certificate file name.</summary>
|
||||
/// <param name="fileName">The name of a certificate file. </param>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">An error with the certificate occurs. For example:The certificate file does not exist.The certificate is invalid.The certificate's password is incorrect.</exception>
|
||||
// Token: 0x060017A3 RID: 6051 RVA: 0x0004F328 File Offset: 0x0004D528
|
||||
public X509Certificate2(string fileName)
|
||||
{
|
||||
this.Import(fileName, string.Empty, X509KeyStorageFlags.DefaultKeySet);
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> class using a certificate file name and a password used to access the certificate.</summary>
|
||||
/// <param name="fileName">The name of a certificate file. </param>
|
||||
/// <param name="password">The password required to access the X.509 certificate data. </param>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">An error with the certificate occurs. For example:The certificate file does not exist.The certificate is invalid.The certificate's password is incorrect.</exception>
|
||||
// Token: 0x060017A4 RID: 6052 RVA: 0x0004F348 File Offset: 0x0004D548
|
||||
public X509Certificate2(string fileName, string password)
|
||||
{
|
||||
this.Import(fileName, password, X509KeyStorageFlags.DefaultKeySet);
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> class using a certificate file name and a password.</summary>
|
||||
/// <param name="fileName">The name of a certificate file. </param>
|
||||
/// <param name="password">The password required to access the X.509 certificate data. </param>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">An error with the certificate occurs. For example:The certificate file does not exist.The certificate is invalid.The certificate's password is incorrect.</exception>
|
||||
// Token: 0x060017A5 RID: 6053 RVA: 0x0004F364 File Offset: 0x0004D564
|
||||
public X509Certificate2(string fileName, SecureString password)
|
||||
{
|
||||
this.Import(fileName, password, X509KeyStorageFlags.DefaultKeySet);
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> class using a certificate file name, a password used to access the certificate, and a key storage flag.</summary>
|
||||
/// <param name="fileName">The name of a certificate file. </param>
|
||||
/// <param name="password">The password required to access the X.509 certificate data. </param>
|
||||
/// <param name="keyStorageFlags">One of the <see cref="T:System.Security.Cryptography.X509Certificates.X509KeyStorageFlags" /> values. </param>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">An error with the certificate occurs. For example:The certificate file does not exist.The certificate is invalid.The certificate's password is incorrect.</exception>
|
||||
// Token: 0x060017A6 RID: 6054 RVA: 0x0004F380 File Offset: 0x0004D580
|
||||
public X509Certificate2(string fileName, string password, X509KeyStorageFlags keyStorageFlags)
|
||||
{
|
||||
this.Import(fileName, password, keyStorageFlags);
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> class using a certificate file name, a password, and a key storage flag.</summary>
|
||||
/// <param name="fileName">The name of a certificate file. </param>
|
||||
/// <param name="password">The password required to access the X.509 certificate data. </param>
|
||||
/// <param name="keyStorageFlags">One of the <see cref="T:System.Security.Cryptography.X509Certificates.X509KeyStorageFlags" /> values that controls where and how to import the private key.. </param>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">An error with the certificate occurs. For example:The certificate file does not exist.The certificate is invalid.The certificate's password is incorrect.</exception>
|
||||
// Token: 0x060017A7 RID: 6055 RVA: 0x0004F39C File Offset: 0x0004D59C
|
||||
public X509Certificate2(string fileName, SecureString password, X509KeyStorageFlags keyStorageFlags)
|
||||
{
|
||||
this.Import(fileName, password, keyStorageFlags);
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> class using an unmanaged handle.</summary>
|
||||
/// <param name="handle">A pointer to a certificate context in unmanaged code. The C structure is called PCCERT_CONTEXT.</param>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">An error with the certificate occurs. For example:The certificate file does not exist.The certificate is invalid.The certificate's password is incorrect.</exception>
|
||||
// Token: 0x060017A8 RID: 6056 RVA: 0x0004F3B8 File Offset: 0x0004D5B8
|
||||
public X509Certificate2(IntPtr handle)
|
||||
: base(handle)
|
||||
{
|
||||
this._cert = new X509Certificate(base.GetRawCertData());
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> class using an <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> object.</summary>
|
||||
/// <param name="certificate">An <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> object.</param>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">An error with the certificate occurs. For example:The certificate file does not exist.The certificate is invalid.The certificate's password is incorrect.</exception>
|
||||
// Token: 0x060017A9 RID: 6057 RVA: 0x0004F3E0 File Offset: 0x0004D5E0
|
||||
public X509Certificate2(X509Certificate certificate)
|
||||
: base(certificate)
|
||||
{
|
||||
this._cert = new X509Certificate(base.GetRawCertData());
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets a value indicating that an X.509 certificate is archived.</summary>
|
||||
/// <returns>true if the certificate is archived, false if the certificate is not archived.</returns>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The certificate is unreadable. </exception>
|
||||
// Token: 0x17000777 RID: 1911
|
||||
// (get) Token: 0x060017AB RID: 6059 RVA: 0x0004F46C File Offset: 0x0004D66C
|
||||
// (set) Token: 0x060017AC RID: 6060 RVA: 0x0004F48C File Offset: 0x0004D68C
|
||||
public bool Archived
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._cert == null)
|
||||
{
|
||||
throw new CryptographicException(X509Certificate2.empty_error);
|
||||
}
|
||||
return this._archived;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (this._cert == null)
|
||||
{
|
||||
throw new CryptographicException(X509Certificate2.empty_error);
|
||||
}
|
||||
this._archived = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a collection of <see cref="T:System.Security.Cryptography.X509Certificates.X509Extension" /> objects.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.X509Certificates.X509ExtensionCollection" /> object.</returns>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The certificate is unreadable. </exception>
|
||||
// Token: 0x17000778 RID: 1912
|
||||
// (get) Token: 0x060017AD RID: 6061 RVA: 0x0004F4AC File Offset: 0x0004D6AC
|
||||
public X509ExtensionCollection Extensions
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._cert == null)
|
||||
{
|
||||
throw new CryptographicException(X509Certificate2.empty_error);
|
||||
}
|
||||
if (this._extensions == null)
|
||||
{
|
||||
this._extensions = new X509ExtensionCollection(this._cert);
|
||||
}
|
||||
return this._extensions;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the associated alias for a certificate.</summary>
|
||||
/// <returns>The certificate's friendly name.</returns>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The certificate is unreadable. </exception>
|
||||
// Token: 0x17000779 RID: 1913
|
||||
// (get) Token: 0x060017AE RID: 6062 RVA: 0x0004F4F4 File Offset: 0x0004D6F4
|
||||
// (set) Token: 0x060017AF RID: 6063 RVA: 0x0004F514 File Offset: 0x0004D714
|
||||
public string FriendlyName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._cert == null)
|
||||
{
|
||||
throw new CryptographicException(X509Certificate2.empty_error);
|
||||
}
|
||||
return this._name;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (this._cert == null)
|
||||
{
|
||||
throw new CryptographicException(X509Certificate2.empty_error);
|
||||
}
|
||||
this._name = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a value that indicates whether an <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> object contains a private key. </summary>
|
||||
/// <returns>true if the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> object contains a private key; otherwise, false. </returns>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The certificate context is invalid.</exception>
|
||||
// Token: 0x1700077A RID: 1914
|
||||
// (get) Token: 0x060017B0 RID: 6064 RVA: 0x0004F534 File Offset: 0x0004D734
|
||||
public bool HasPrivateKey
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.PrivateKey != null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the distinguished name of the certificate issuer.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.X509Certificates.X500DistinguishedName" /> object that contains the name of the certificate issuer.</returns>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The certificate context is invalid.</exception>
|
||||
// Token: 0x1700077B RID: 1915
|
||||
// (get) Token: 0x060017B1 RID: 6065 RVA: 0x0004F544 File Offset: 0x0004D744
|
||||
public X500DistinguishedName IssuerName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._cert == null)
|
||||
{
|
||||
throw new CryptographicException(X509Certificate2.empty_error);
|
||||
}
|
||||
if (this.issuer_name == null)
|
||||
{
|
||||
this.issuer_name = new X500DistinguishedName(this._cert.GetIssuerName().GetBytes());
|
||||
}
|
||||
return this.issuer_name;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the date in local time after which a certificate is no longer valid.</summary>
|
||||
/// <returns>A <see cref="T:System.DateTime" /> object that represents the expiration date for the certificate .</returns>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The certificate is unreadable. </exception>
|
||||
// Token: 0x1700077C RID: 1916
|
||||
// (get) Token: 0x060017B2 RID: 6066 RVA: 0x0004F594 File Offset: 0x0004D794
|
||||
public DateTime NotAfter
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._cert == null)
|
||||
{
|
||||
throw new CryptographicException(X509Certificate2.empty_error);
|
||||
}
|
||||
return this._cert.ValidUntil.ToLocalTime();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the date in local time on which a certificate becomes valid.</summary>
|
||||
/// <returns>A <see cref="T:System.DateTime" /> object that represents the effective date of the certificate.</returns>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The certificate is unreadable. </exception>
|
||||
// Token: 0x1700077D RID: 1917
|
||||
// (get) Token: 0x060017B3 RID: 6067 RVA: 0x0004F5CC File Offset: 0x0004D7CC
|
||||
public DateTime NotBefore
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._cert == null)
|
||||
{
|
||||
throw new CryptographicException(X509Certificate2.empty_error);
|
||||
}
|
||||
return this._cert.ValidFrom.ToLocalTime();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the <see cref="T:System.Security.Cryptography.AsymmetricAlgorithm" /> object that represents the private key associated with a certificate.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.AsymmetricAlgorithm" /> object, which is either an RSA or DSA cryptographic service provider.</returns>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The key value is not an RSA or DSA key, or the key is unreadable. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">The value being set for this property is null.</exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The key algorithm for this private key is not supported.</exception>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicUnexpectedOperationException">The X.509 keys do not match.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">The cryptographic service provider key is null.</exception>
|
||||
// Token: 0x1700077E RID: 1918
|
||||
// (get) Token: 0x060017B4 RID: 6068 RVA: 0x0004F604 File Offset: 0x0004D804
|
||||
// (set) Token: 0x060017B5 RID: 6069 RVA: 0x0004F744 File Offset: 0x0004D944
|
||||
public AsymmetricAlgorithm PrivateKey
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._cert == null)
|
||||
{
|
||||
throw new CryptographicException(X509Certificate2.empty_error);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (this._cert.RSA != null)
|
||||
{
|
||||
RSACryptoServiceProvider rsacryptoServiceProvider = this._cert.RSA as RSACryptoServiceProvider;
|
||||
if (rsacryptoServiceProvider != null)
|
||||
{
|
||||
return (!rsacryptoServiceProvider.PublicOnly) ? rsacryptoServiceProvider : null;
|
||||
}
|
||||
RSAManaged rsamanaged = this._cert.RSA as RSAManaged;
|
||||
if (rsamanaged != null)
|
||||
{
|
||||
return (!rsamanaged.PublicOnly) ? rsamanaged : null;
|
||||
}
|
||||
this._cert.RSA.ExportParameters(true);
|
||||
return this._cert.RSA;
|
||||
}
|
||||
else if (this._cert.DSA != null)
|
||||
{
|
||||
DSACryptoServiceProvider dsacryptoServiceProvider = this._cert.DSA as DSACryptoServiceProvider;
|
||||
if (dsacryptoServiceProvider != null)
|
||||
{
|
||||
return (!dsacryptoServiceProvider.PublicOnly) ? dsacryptoServiceProvider : null;
|
||||
}
|
||||
this._cert.DSA.ExportParameters(true);
|
||||
return this._cert.DSA;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
return null;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (this._cert == null)
|
||||
{
|
||||
throw new CryptographicException(X509Certificate2.empty_error);
|
||||
}
|
||||
if (value == null)
|
||||
{
|
||||
this._cert.RSA = null;
|
||||
this._cert.DSA = null;
|
||||
}
|
||||
else if (value is RSA)
|
||||
{
|
||||
this._cert.RSA = (RSA)value;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(value is DSA))
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
this._cert.DSA = (DSA)value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a <see cref="P:System.Security.Cryptography.X509Certificates.X509Certificate2.PublicKey" /> object associated with a certificate.</summary>
|
||||
/// <returns>A <see cref="P:System.Security.Cryptography.X509Certificates.X509Certificate2.PublicKey" /> object.</returns>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The key value is not an RSA or DSA key, or the key is unreadable. </exception>
|
||||
// Token: 0x1700077F RID: 1919
|
||||
// (get) Token: 0x060017B6 RID: 6070 RVA: 0x0004F7D4 File Offset: 0x0004D9D4
|
||||
public PublicKey PublicKey
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._cert == null)
|
||||
{
|
||||
throw new CryptographicException(X509Certificate2.empty_error);
|
||||
}
|
||||
if (this._publicKey == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
this._publicKey = new PublicKey(this._cert);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string text = global::Locale.GetText("Unable to decode public key.");
|
||||
throw new CryptographicException(text, ex);
|
||||
}
|
||||
}
|
||||
return this._publicKey;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the raw data of a certificate.</summary>
|
||||
/// <returns>The raw data of the certificate as a byte array.</returns>
|
||||
// Token: 0x17000780 RID: 1920
|
||||
// (get) Token: 0x060017B7 RID: 6071 RVA: 0x0004F854 File Offset: 0x0004DA54
|
||||
public byte[] RawData
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._cert == null)
|
||||
{
|
||||
throw new CryptographicException(X509Certificate2.empty_error);
|
||||
}
|
||||
return base.GetRawCertData();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the serial number of a certificate.</summary>
|
||||
/// <returns>The serial number of the certificate.</returns>
|
||||
// Token: 0x17000781 RID: 1921
|
||||
// (get) Token: 0x060017B8 RID: 6072 RVA: 0x0004F874 File Offset: 0x0004DA74
|
||||
public string SerialNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._cert == null)
|
||||
{
|
||||
throw new CryptographicException(X509Certificate2.empty_error);
|
||||
}
|
||||
if (this._serial == null)
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
byte[] serialNumber = this._cert.SerialNumber;
|
||||
for (int i = serialNumber.Length - 1; i >= 0; i--)
|
||||
{
|
||||
stringBuilder.Append(serialNumber[i].ToString("X2"));
|
||||
}
|
||||
this._serial = stringBuilder.ToString();
|
||||
}
|
||||
return this._serial;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the algorithm used to create the signature of a certificate.</summary>
|
||||
/// <returns>Returns the object identifier (<see cref="T:System.Security.Cryptography.Oid" />) of the signature algorithm.</returns>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The certificate is unreadable. </exception>
|
||||
// Token: 0x17000782 RID: 1922
|
||||
// (get) Token: 0x060017B9 RID: 6073 RVA: 0x0004F8F4 File Offset: 0x0004DAF4
|
||||
public Oid SignatureAlgorithm
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._cert == null)
|
||||
{
|
||||
throw new CryptographicException(X509Certificate2.empty_error);
|
||||
}
|
||||
if (this.signature_algorithm == null)
|
||||
{
|
||||
this.signature_algorithm = new Oid(this._cert.SignatureAlgorithm);
|
||||
}
|
||||
return this.signature_algorithm;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the subject distinguished name from a certificate.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.X509Certificates.X500DistinguishedName" /> object that represents the name of the certificate subject.</returns>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The certificate context is invalid.</exception>
|
||||
// Token: 0x17000783 RID: 1923
|
||||
// (get) Token: 0x060017BA RID: 6074 RVA: 0x0004F934 File Offset: 0x0004DB34
|
||||
public X500DistinguishedName SubjectName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._cert == null)
|
||||
{
|
||||
throw new CryptographicException(X509Certificate2.empty_error);
|
||||
}
|
||||
if (this.subject_name == null)
|
||||
{
|
||||
this.subject_name = new X500DistinguishedName(this._cert.GetSubjectName().GetBytes());
|
||||
}
|
||||
return this.subject_name;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the thumbprint of a certificate.</summary>
|
||||
/// <returns>The thumbprint of the certificate.</returns>
|
||||
// Token: 0x17000784 RID: 1924
|
||||
// (get) Token: 0x060017BB RID: 6075 RVA: 0x0004F984 File Offset: 0x0004DB84
|
||||
public string Thumbprint
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.GetCertHashString();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the X.509 format version of a certificate.</summary>
|
||||
/// <returns>The certificate format.</returns>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The certificate is unreadable. </exception>
|
||||
// Token: 0x17000785 RID: 1925
|
||||
// (get) Token: 0x060017BC RID: 6076 RVA: 0x0004F98C File Offset: 0x0004DB8C
|
||||
public int Version
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._cert == null)
|
||||
{
|
||||
throw new CryptographicException(X509Certificate2.empty_error);
|
||||
}
|
||||
return this._cert.Version;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the subject and issuer names from a certificate.</summary>
|
||||
/// <returns>The name of the certificate.</returns>
|
||||
/// <param name="nameType">The <see cref="T:System.Security.Cryptography.X509Certificates.X509NameType" /> value for the subject. </param>
|
||||
/// <param name="forIssuer">true to include the issuer name; otherwise, false. </param>
|
||||
// Token: 0x060017BD RID: 6077 RVA: 0x0004F9B0 File Offset: 0x0004DBB0
|
||||
[global::System.MonoTODO("always return String.Empty for UpnName, DnsFromAlternativeName and UrlName")]
|
||||
public string GetNameInfo(X509NameType nameType, bool forIssuer)
|
||||
{
|
||||
switch (nameType)
|
||||
{
|
||||
case X509NameType.SimpleName:
|
||||
{
|
||||
if (this._cert == null)
|
||||
{
|
||||
throw new CryptographicException(X509Certificate2.empty_error);
|
||||
}
|
||||
ASN1 asn = ((!forIssuer) ? this._cert.GetSubjectName() : this._cert.GetIssuerName());
|
||||
ASN1 asn2 = this.Find(X509Certificate2.commonName, asn);
|
||||
if (asn2 != null)
|
||||
{
|
||||
return this.GetValueAsString(asn2);
|
||||
}
|
||||
if (asn.Count == 0)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
ASN1 asn3 = asn[asn.Count - 1];
|
||||
if (asn3.Count == 0)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
return this.GetValueAsString(asn3[0]);
|
||||
}
|
||||
case X509NameType.EmailName:
|
||||
{
|
||||
ASN1 asn4 = this.Find(X509Certificate2.email, (!forIssuer) ? this._cert.GetSubjectName() : this._cert.GetIssuerName());
|
||||
if (asn4 != null)
|
||||
{
|
||||
return this.GetValueAsString(asn4);
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
case X509NameType.UpnName:
|
||||
return string.Empty;
|
||||
case X509NameType.DnsName:
|
||||
{
|
||||
ASN1 asn5 = this.Find(X509Certificate2.commonName, (!forIssuer) ? this._cert.GetSubjectName() : this._cert.GetIssuerName());
|
||||
if (asn5 != null)
|
||||
{
|
||||
return this.GetValueAsString(asn5);
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
case X509NameType.DnsFromAlternativeName:
|
||||
return string.Empty;
|
||||
case X509NameType.UrlName:
|
||||
return string.Empty;
|
||||
default:
|
||||
throw new ArgumentException("nameType");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060017BE RID: 6078 RVA: 0x0004FB18 File Offset: 0x0004DD18
|
||||
private ASN1 Find(byte[] oid, ASN1 dn)
|
||||
{
|
||||
if (dn.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
for (int i = 0; i < dn.Count; i++)
|
||||
{
|
||||
ASN1 asn = dn[i];
|
||||
for (int j = 0; j < asn.Count; j++)
|
||||
{
|
||||
ASN1 asn2 = asn[j];
|
||||
if (asn2.Count == 2)
|
||||
{
|
||||
ASN1 asn3 = asn2[0];
|
||||
if (asn3 != null)
|
||||
{
|
||||
if (asn3.CompareValue(oid))
|
||||
{
|
||||
return asn2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Token: 0x060017BF RID: 6079 RVA: 0x0004FBA8 File Offset: 0x0004DDA8
|
||||
private string GetValueAsString(ASN1 pair)
|
||||
{
|
||||
if (pair.Count != 2)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
ASN1 asn = pair[1];
|
||||
if (asn.Value == null || asn.Length == 0)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
if (asn.Tag == 30)
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (int i = 1; i < asn.Value.Length; i += 2)
|
||||
{
|
||||
stringBuilder.Append((char)asn.Value[i]);
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
return Encoding.UTF8.GetString(asn.Value);
|
||||
}
|
||||
|
||||
// Token: 0x060017C0 RID: 6080 RVA: 0x0004FC40 File Offset: 0x0004DE40
|
||||
private void ImportPkcs12(byte[] rawData, string password)
|
||||
{
|
||||
PKCS12 pkcs = ((password != null) ? new PKCS12(rawData, password) : new PKCS12(rawData));
|
||||
if (pkcs.Certificates.Count > 0)
|
||||
{
|
||||
this._cert = pkcs.Certificates[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
this._cert = null;
|
||||
}
|
||||
if (pkcs.Keys.Count > 0)
|
||||
{
|
||||
this._cert.RSA = pkcs.Keys[0] as RSA;
|
||||
this._cert.DSA = pkcs.Keys[0] as DSA;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Populates an <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> object with data from a byte array.</summary>
|
||||
/// <param name="rawData">A byte array containing data from an X.509 certificate. </param>
|
||||
// Token: 0x060017C1 RID: 6081 RVA: 0x0004FCE0 File Offset: 0x0004DEE0
|
||||
public override void Import(byte[] rawData)
|
||||
{
|
||||
this.Import(rawData, null, X509KeyStorageFlags.DefaultKeySet);
|
||||
}
|
||||
|
||||
/// <summary>Populates an <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> object using data from a byte array, a password, and flags for determining how to import the private key.</summary>
|
||||
/// <param name="rawData">A byte array containing data from an X.509 certificate. </param>
|
||||
/// <param name="password">The password required to access the X.509 certificate data. </param>
|
||||
/// <param name="keyStorageFlags">One of the <see cref="T:System.Security.Cryptography.X509Certificates.X509KeyStorageFlags" /> values used to control where and how to import the private key. </param>
|
||||
// Token: 0x060017C2 RID: 6082 RVA: 0x0004FCEC File Offset: 0x0004DEEC
|
||||
[global::System.MonoTODO("missing KeyStorageFlags support")]
|
||||
public override void Import(byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags)
|
||||
{
|
||||
base.Import(rawData, password, keyStorageFlags);
|
||||
if (password == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
this._cert = new X509Certificate(rawData);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.ImportPkcs12(rawData, null);
|
||||
}
|
||||
catch
|
||||
{
|
||||
string text = global::Locale.GetText("Unable to decode certificate.");
|
||||
throw new CryptographicException(text, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
this.ImportPkcs12(rawData, password);
|
||||
}
|
||||
catch
|
||||
{
|
||||
this._cert = new X509Certificate(rawData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Populates an <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> object using data from a byte array, a password, and a key storage flag.</summary>
|
||||
/// <param name="rawData">A byte array that contains data from an X.509 certificate. </param>
|
||||
/// <param name="password">The password required to access the X.509 certificate data. </param>
|
||||
/// <param name="keyStorageFlags">One of the <see cref="T:System.Security.Cryptography.X509Certificates.X509KeyStorageFlags" /> values that controls where and how to import the private key. </param>
|
||||
// Token: 0x060017C3 RID: 6083 RVA: 0x0004FDB8 File Offset: 0x0004DFB8
|
||||
[global::System.MonoTODO("SecureString is incomplete")]
|
||||
public override void Import(byte[] rawData, SecureString password, X509KeyStorageFlags keyStorageFlags)
|
||||
{
|
||||
this.Import(rawData, null, keyStorageFlags);
|
||||
}
|
||||
|
||||
/// <summary>Populates an <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> object with information from a certificate file.</summary>
|
||||
/// <param name="fileName">The name of a certificate. </param>
|
||||
// Token: 0x060017C4 RID: 6084 RVA: 0x0004FDC4 File Offset: 0x0004DFC4
|
||||
public override void Import(string fileName)
|
||||
{
|
||||
byte[] array = X509Certificate2.Load(fileName);
|
||||
this.Import(array, null, X509KeyStorageFlags.DefaultKeySet);
|
||||
}
|
||||
|
||||
/// <summary>Populates an <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> object with information from a certificate file, a password, and a <see cref="T:System.Security.Cryptography.X509Certificates.X509KeyStorageFlags" /> value.</summary>
|
||||
/// <param name="fileName">The name of a certificate file. </param>
|
||||
/// <param name="password">The password required to access the X.509 certificate data. </param>
|
||||
/// <param name="keyStorageFlags">One of the <see cref="T:System.Security.Cryptography.X509Certificates.X509KeyStorageFlags" /> values used to control where and how to import the private key. </param>
|
||||
// Token: 0x060017C5 RID: 6085 RVA: 0x0004FDE4 File Offset: 0x0004DFE4
|
||||
[global::System.MonoTODO("missing KeyStorageFlags support")]
|
||||
public override void Import(string fileName, string password, X509KeyStorageFlags keyStorageFlags)
|
||||
{
|
||||
byte[] array = X509Certificate2.Load(fileName);
|
||||
this.Import(array, password, keyStorageFlags);
|
||||
}
|
||||
|
||||
/// <summary>Populates an <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> object with information from a certificate file, a password, and a key storage flag.</summary>
|
||||
/// <param name="fileName">The name of a certificate file. </param>
|
||||
/// <param name="password">The password required to access the X.509 certificate data. </param>
|
||||
/// <param name="keyStorageFlags">One of the <see cref="T:System.Security.Cryptography.X509Certificates.X509KeyStorageFlags" /> values that controls where and how to import the private key. </param>
|
||||
// Token: 0x060017C6 RID: 6086 RVA: 0x0004FE04 File Offset: 0x0004E004
|
||||
[global::System.MonoTODO("SecureString is incomplete")]
|
||||
public override void Import(string fileName, SecureString password, X509KeyStorageFlags keyStorageFlags)
|
||||
{
|
||||
byte[] array = X509Certificate2.Load(fileName);
|
||||
this.Import(array, null, keyStorageFlags);
|
||||
}
|
||||
|
||||
// Token: 0x060017C7 RID: 6087 RVA: 0x0004FE24 File Offset: 0x0004E024
|
||||
private static byte[] Load(string fileName)
|
||||
{
|
||||
byte[] array = null;
|
||||
using (FileStream fileStream = File.OpenRead(fileName))
|
||||
{
|
||||
array = new byte[fileStream.Length];
|
||||
fileStream.Read(array, 0, array.Length);
|
||||
fileStream.Close();
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
/// <summary>Resets the state of an <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> object.</summary>
|
||||
// Token: 0x060017C8 RID: 6088 RVA: 0x0004FE88 File Offset: 0x0004E088
|
||||
public override void Reset()
|
||||
{
|
||||
this._cert = null;
|
||||
this._archived = false;
|
||||
this._extensions = null;
|
||||
this._name = string.Empty;
|
||||
this._serial = null;
|
||||
this._publicKey = null;
|
||||
this.issuer_name = null;
|
||||
this.subject_name = null;
|
||||
this.signature_algorithm = null;
|
||||
base.Reset();
|
||||
}
|
||||
|
||||
/// <summary>Displays an X.509 certificate in text format.</summary>
|
||||
/// <returns>The certificate information.</returns>
|
||||
// Token: 0x060017C9 RID: 6089 RVA: 0x0004FEE0 File Offset: 0x0004E0E0
|
||||
public override string ToString()
|
||||
{
|
||||
if (this._cert == null)
|
||||
{
|
||||
return "System.Security.Cryptography.X509Certificates.X509Certificate2";
|
||||
}
|
||||
return base.ToString(true);
|
||||
}
|
||||
|
||||
/// <summary>Displays an X.509 certificate in text format.</summary>
|
||||
/// <returns>The certificate information.</returns>
|
||||
/// <param name="verbose">true to display the public key, private key, extensions, and so forth; false to display information that is similar to the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> class, including thumbprint, serial number, subject and issuer names, and so on. </param>
|
||||
// Token: 0x060017CA RID: 6090 RVA: 0x0004FEFC File Offset: 0x0004E0FC
|
||||
public override string ToString(bool verbose)
|
||||
{
|
||||
if (this._cert == null)
|
||||
{
|
||||
return "System.Security.Cryptography.X509Certificates.X509Certificate2";
|
||||
}
|
||||
if (!verbose)
|
||||
{
|
||||
return base.ToString(true);
|
||||
}
|
||||
string newLine = Environment.NewLine;
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.AppendFormat("[Version]{0} V{1}{0}{0}", newLine, this.Version);
|
||||
stringBuilder.AppendFormat("[Subject]{0} {1}{0}{0}", newLine, base.Subject);
|
||||
stringBuilder.AppendFormat("[Issuer]{0} {1}{0}{0}", newLine, base.Issuer);
|
||||
stringBuilder.AppendFormat("[Serial Number]{0} {1}{0}{0}", newLine, this.SerialNumber);
|
||||
stringBuilder.AppendFormat("[Not Before]{0} {1}{0}{0}", newLine, this.NotBefore);
|
||||
stringBuilder.AppendFormat("[Not After]{0} {1}{0}{0}", newLine, this.NotAfter);
|
||||
stringBuilder.AppendFormat("[Thumbprint]{0} {1}{0}{0}", newLine, this.Thumbprint);
|
||||
stringBuilder.AppendFormat("[Signature Algorithm]{0} {1}({2}){0}{0}", newLine, this.SignatureAlgorithm.FriendlyName, this.SignatureAlgorithm.Value);
|
||||
AsymmetricAlgorithm key = this.PublicKey.Key;
|
||||
stringBuilder.AppendFormat("[Public Key]{0} Algorithm: ", newLine);
|
||||
if (key is RSA)
|
||||
{
|
||||
stringBuilder.Append("RSA");
|
||||
}
|
||||
else if (key is DSA)
|
||||
{
|
||||
stringBuilder.Append("DSA");
|
||||
}
|
||||
else
|
||||
{
|
||||
stringBuilder.Append(key.ToString());
|
||||
}
|
||||
stringBuilder.AppendFormat("{0} Length: {1}{0} Key Blob: ", newLine, key.KeySize);
|
||||
X509Certificate2.AppendBuffer(stringBuilder, this.PublicKey.EncodedKeyValue.RawData);
|
||||
stringBuilder.AppendFormat("{0} Parameters: ", newLine);
|
||||
X509Certificate2.AppendBuffer(stringBuilder, this.PublicKey.EncodedParameters.RawData);
|
||||
stringBuilder.Append(newLine);
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
// Token: 0x060017CB RID: 6091 RVA: 0x000500A8 File Offset: 0x0004E2A8
|
||||
private static void AppendBuffer(StringBuilder sb, byte[] buffer)
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < buffer.Length; i++)
|
||||
{
|
||||
sb.Append(buffer[i].ToString("x2"));
|
||||
if (i < buffer.Length - 1)
|
||||
{
|
||||
sb.Append(" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Performs a X.509 chain validation using basic validation policy.</summary>
|
||||
/// <returns>true if the validation succeeds; false if the validation fails.</returns>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The certificate is unreadable. </exception>
|
||||
// Token: 0x060017CC RID: 6092 RVA: 0x00050100 File Offset: 0x0004E300
|
||||
[global::System.MonoTODO("by default this depends on the incomplete X509Chain")]
|
||||
public bool Verify()
|
||||
{
|
||||
if (this._cert == null)
|
||||
{
|
||||
throw new CryptographicException(X509Certificate2.empty_error);
|
||||
}
|
||||
X509Chain x509Chain = (X509Chain)CryptoConfig.CreateFromName("X509Chain");
|
||||
return x509Chain.Build(this);
|
||||
}
|
||||
|
||||
/// <summary>Indicates the type of certificate contained in a byte array.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.X509Certificates.X509ContentType" /> object.</returns>
|
||||
/// <param name="rawData">A byte array containing data from an X.509 certificate. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="rawData" /> has a zero length or is null. </exception>
|
||||
// Token: 0x060017CD RID: 6093 RVA: 0x00050144 File Offset: 0x0004E344
|
||||
[global::System.MonoTODO("Detection limited to Cert, Pfx, Pkcs12, Pkcs7 and Unknown")]
|
||||
public static X509ContentType GetCertContentType(byte[] rawData)
|
||||
{
|
||||
if (rawData == null || rawData.Length == 0)
|
||||
{
|
||||
throw new ArgumentException("rawData");
|
||||
}
|
||||
X509ContentType x509ContentType = X509ContentType.Unknown;
|
||||
try
|
||||
{
|
||||
ASN1 asn = new ASN1(rawData);
|
||||
if (asn.Tag != 48)
|
||||
{
|
||||
string text = global::Locale.GetText("Unable to decode certificate.");
|
||||
throw new CryptographicException(text);
|
||||
}
|
||||
if (asn.Count == 0)
|
||||
{
|
||||
return x509ContentType;
|
||||
}
|
||||
if (asn.Count == 3)
|
||||
{
|
||||
byte tag = asn[0].Tag;
|
||||
if (tag != 2)
|
||||
{
|
||||
if (tag == 48)
|
||||
{
|
||||
if (asn[1].Tag == 48 && asn[2].Tag == 3)
|
||||
{
|
||||
x509ContentType = X509ContentType.Cert;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (asn[1].Tag == 48 && asn[2].Tag == 48)
|
||||
{
|
||||
x509ContentType = X509ContentType.Pfx;
|
||||
}
|
||||
}
|
||||
if (asn[0].Tag == 6 && asn[0].CompareValue(X509Certificate2.signedData))
|
||||
{
|
||||
x509ContentType = X509ContentType.Pkcs7;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string text2 = global::Locale.GetText("Unable to decode certificate.");
|
||||
throw new CryptographicException(text2, ex);
|
||||
}
|
||||
return x509ContentType;
|
||||
}
|
||||
|
||||
/// <summary>Indicates the type of certificate contained in a file.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.X509Certificates.X509ContentType" /> object.</returns>
|
||||
/// <param name="fileName">The name of a certificate file. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="fileName" /> is null.</exception>
|
||||
// Token: 0x060017CE RID: 6094 RVA: 0x00050298 File Offset: 0x0004E498
|
||||
[global::System.MonoTODO("Detection limited to Cert, Pfx, Pkcs12 and Unknown")]
|
||||
public static X509ContentType GetCertContentType(string fileName)
|
||||
{
|
||||
if (fileName == null)
|
||||
{
|
||||
throw new ArgumentNullException("fileName");
|
||||
}
|
||||
if (fileName.Length == 0)
|
||||
{
|
||||
throw new ArgumentException("fileName");
|
||||
}
|
||||
byte[] array = X509Certificate2.Load(fileName);
|
||||
return X509Certificate2.GetCertContentType(array);
|
||||
}
|
||||
|
||||
// Token: 0x17000786 RID: 1926
|
||||
// (get) Token: 0x060017CF RID: 6095 RVA: 0x000502DC File Offset: 0x0004E4DC
|
||||
internal X509Certificate MonoCertificate
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._cert;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040012F8 RID: 4856
|
||||
private bool _archived;
|
||||
|
||||
// Token: 0x040012F9 RID: 4857
|
||||
private X509ExtensionCollection _extensions;
|
||||
|
||||
// Token: 0x040012FA RID: 4858
|
||||
private string _name = string.Empty;
|
||||
|
||||
// Token: 0x040012FB RID: 4859
|
||||
private string _serial;
|
||||
|
||||
// Token: 0x040012FC RID: 4860
|
||||
private PublicKey _publicKey;
|
||||
|
||||
// Token: 0x040012FD RID: 4861
|
||||
private X500DistinguishedName issuer_name;
|
||||
|
||||
// Token: 0x040012FE RID: 4862
|
||||
private X500DistinguishedName subject_name;
|
||||
|
||||
// Token: 0x040012FF RID: 4863
|
||||
private Oid signature_algorithm;
|
||||
|
||||
// Token: 0x04001300 RID: 4864
|
||||
private X509Certificate _cert;
|
||||
|
||||
// Token: 0x04001301 RID: 4865
|
||||
private static string empty_error = global::Locale.GetText("Certificate instance is empty.");
|
||||
|
||||
// Token: 0x04001302 RID: 4866
|
||||
private static byte[] commonName = new byte[] { 85, 4, 3 };
|
||||
|
||||
// Token: 0x04001303 RID: 4867
|
||||
private static byte[] email = new byte[] { 42, 134, 72, 134, 247, 13, 1, 9, 1 };
|
||||
|
||||
// Token: 0x04001304 RID: 4868
|
||||
private static byte[] signedData = new byte[] { 42, 134, 72, 134, 247, 13, 1, 7, 2 };
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,515 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Represents a collection of <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> objects. This class cannot be inherited.</summary>
|
||||
// Token: 0x02000289 RID: 649
|
||||
public class X509Certificate2Collection : X509CertificateCollection
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> class without any <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> information.</summary>
|
||||
// Token: 0x060017D0 RID: 6096 RVA: 0x000502E4 File Offset: 0x0004E4E4
|
||||
public X509Certificate2Collection()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> class using the specified certificate collection.</summary>
|
||||
/// <param name="certificates">An <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> object. </param>
|
||||
// Token: 0x060017D1 RID: 6097 RVA: 0x000502EC File Offset: 0x0004E4EC
|
||||
public X509Certificate2Collection(X509Certificate2Collection certificates)
|
||||
{
|
||||
this.AddRange(certificates);
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> class using an <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> object.</summary>
|
||||
/// <param name="certificate">An <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> object to start the collection from.</param>
|
||||
// Token: 0x060017D2 RID: 6098 RVA: 0x000502FC File Offset: 0x0004E4FC
|
||||
public X509Certificate2Collection(X509Certificate2 certificate)
|
||||
{
|
||||
this.Add(certificate);
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> class using an array of <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> objects.</summary>
|
||||
/// <param name="certificates">An array of <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> objects. </param>
|
||||
// Token: 0x060017D3 RID: 6099 RVA: 0x0005030C File Offset: 0x0004E50C
|
||||
public X509Certificate2Collection(X509Certificate2[] certificates)
|
||||
{
|
||||
this.AddRange(certificates);
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the element at the specified index.</summary>
|
||||
/// <returns>The element at the specified index.</returns>
|
||||
/// <param name="index">The zero-based index of the element to get or set. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> is less than zero.-or- <paramref name="index" /> is equal to or greater than the <see cref="P:System.Collections.CollectionBase.Count" /> property. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="index" /> is null. </exception>
|
||||
// Token: 0x17000787 RID: 1927
|
||||
public X509Certificate2 this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (index < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("negative index");
|
||||
}
|
||||
if (index >= base.InnerList.Count)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index >= Count");
|
||||
}
|
||||
return (X509Certificate2)base.InnerList[index];
|
||||
}
|
||||
set
|
||||
{
|
||||
base.InnerList[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Adds an object to the end of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" />.</summary>
|
||||
/// <returns>The <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> index at which the <paramref name="certificate" /> has been added.</returns>
|
||||
/// <param name="certificate">An X.509 certificate represented as an <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> object. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="certificate" /> is null. </exception>
|
||||
// Token: 0x060017D6 RID: 6102 RVA: 0x00050378 File Offset: 0x0004E578
|
||||
public int Add(X509Certificate2 certificate)
|
||||
{
|
||||
if (certificate == null)
|
||||
{
|
||||
throw new ArgumentNullException("certificate");
|
||||
}
|
||||
return base.InnerList.Add(certificate);
|
||||
}
|
||||
|
||||
/// <summary>Adds multiple <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> objects in an array to the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> object.</summary>
|
||||
/// <param name="certificates">An array of <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> objects. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="certificates" /> is null. </exception>
|
||||
// Token: 0x060017D7 RID: 6103 RVA: 0x00050398 File Offset: 0x0004E598
|
||||
[global::System.MonoTODO("Method isn't transactional (like documented)")]
|
||||
public void AddRange(X509Certificate2[] certificates)
|
||||
{
|
||||
if (certificates == null)
|
||||
{
|
||||
throw new ArgumentNullException("certificates");
|
||||
}
|
||||
for (int i = 0; i < certificates.Length; i++)
|
||||
{
|
||||
base.InnerList.Add(certificates[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Adds multiple <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> objects in an <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> object to another <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> object.</summary>
|
||||
/// <param name="certificates">An <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> object. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="certificates" /> is null. </exception>
|
||||
// Token: 0x060017D8 RID: 6104 RVA: 0x000503DC File Offset: 0x0004E5DC
|
||||
[global::System.MonoTODO("Method isn't transactional (like documented)")]
|
||||
public void AddRange(X509Certificate2Collection certificates)
|
||||
{
|
||||
if (certificates == null)
|
||||
{
|
||||
throw new ArgumentNullException("certificates");
|
||||
}
|
||||
base.InnerList.AddRange(certificates);
|
||||
}
|
||||
|
||||
/// <summary>Determines whether the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> object contains a specific certificate.</summary>
|
||||
/// <returns>true if the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> contains the specified <paramref name="certificate" />; otherwise, false.</returns>
|
||||
/// <param name="certificate">The <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> object to locate in the collection. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="certificate" /> is null. </exception>
|
||||
// Token: 0x060017D9 RID: 6105 RVA: 0x000503FC File Offset: 0x0004E5FC
|
||||
public bool Contains(X509Certificate2 certificate)
|
||||
{
|
||||
if (certificate == null)
|
||||
{
|
||||
throw new ArgumentNullException("certificate");
|
||||
}
|
||||
foreach (object obj in base.InnerList)
|
||||
{
|
||||
X509Certificate2 x509Certificate = (X509Certificate2)obj;
|
||||
if (x509Certificate.Equals(certificate))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>Exports X.509 certificate information into a byte array.</summary>
|
||||
/// <returns>X.509 certificate information in a byte array.</returns>
|
||||
/// <param name="contentType">A supported <see cref="T:System.Security.Cryptography.X509Certificates.X509ContentType" /> object. </param>
|
||||
// Token: 0x060017DA RID: 6106 RVA: 0x0005048C File Offset: 0x0004E68C
|
||||
[global::System.MonoTODO("only support X509ContentType.Cert")]
|
||||
public byte[] Export(X509ContentType contentType)
|
||||
{
|
||||
return this.Export(contentType, null);
|
||||
}
|
||||
|
||||
/// <summary>Exports X.509 certificate information into a byte array using a password.</summary>
|
||||
/// <returns>X.509 certificate information in a byte array.</returns>
|
||||
/// <param name="contentType">A supported <see cref="T:System.Security.Cryptography.X509Certificates.X509ContentType" /> object. </param>
|
||||
/// <param name="password">A string used to protect the byte array. </param>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The certificate is unreadable, the content is invalid or, in the case of a certificate requiring a password, the private key could not be exported because the password provided was incorrect. </exception>
|
||||
// Token: 0x060017DB RID: 6107 RVA: 0x00050498 File Offset: 0x0004E698
|
||||
[global::System.MonoTODO("only support X509ContentType.Cert")]
|
||||
public byte[] Export(X509ContentType contentType, string password)
|
||||
{
|
||||
switch (contentType)
|
||||
{
|
||||
case X509ContentType.Cert:
|
||||
case X509ContentType.SerializedCert:
|
||||
case X509ContentType.Pfx:
|
||||
if (this.Count > 0)
|
||||
{
|
||||
return this[this.Count - 1].Export(contentType, password);
|
||||
}
|
||||
break;
|
||||
case X509ContentType.SerializedStore:
|
||||
break;
|
||||
case X509ContentType.Pkcs7:
|
||||
break;
|
||||
default:
|
||||
{
|
||||
string text = global::Locale.GetText("Cannot export certificate(s) to the '{0}' format", new object[] { contentType });
|
||||
throw new CryptographicException(text);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>Searches an <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> object using the search criteria specified by the <see cref="T:System.Security.Cryptography.X509Certificates.X509FindType" /> enumeration and the <paramref name="findValue" /> object.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> object.</returns>
|
||||
/// <param name="findType">One of the <see cref="T:System.Security.Cryptography.X509Certificates.X509FindType" /> values. </param>
|
||||
/// <param name="findValue">The search criteria as an object. </param>
|
||||
/// <param name="validOnly">true to allow only valid certificates to be returned from the search; otherwise, false. </param>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">
|
||||
/// <paramref name="findType" /> is invalid. </exception>
|
||||
// Token: 0x060017DC RID: 6108 RVA: 0x0005051C File Offset: 0x0004E71C
|
||||
[global::System.MonoTODO("Does not support X509FindType.FindByTemplateName, FindByApplicationPolicy and FindByCertificatePolicy")]
|
||||
public X509Certificate2Collection Find(X509FindType findType, object findValue, bool validOnly)
|
||||
{
|
||||
if (findValue == null)
|
||||
{
|
||||
throw new ArgumentNullException("findValue");
|
||||
}
|
||||
string text = string.Empty;
|
||||
string text2 = string.Empty;
|
||||
X509KeyUsageFlags x509KeyUsageFlags = X509KeyUsageFlags.None;
|
||||
DateTime dateTime = DateTime.MinValue;
|
||||
switch (findType)
|
||||
{
|
||||
case X509FindType.FindByThumbprint:
|
||||
case X509FindType.FindBySubjectName:
|
||||
case X509FindType.FindBySubjectDistinguishedName:
|
||||
case X509FindType.FindByIssuerName:
|
||||
case X509FindType.FindByIssuerDistinguishedName:
|
||||
case X509FindType.FindBySerialNumber:
|
||||
case X509FindType.FindByTemplateName:
|
||||
case X509FindType.FindBySubjectKeyIdentifier:
|
||||
try
|
||||
{
|
||||
text = (string)findValue;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string text3 = global::Locale.GetText("Invalid find value type '{0}', expected '{1}'.", new object[]
|
||||
{
|
||||
findValue.GetType(),
|
||||
"string"
|
||||
});
|
||||
throw new CryptographicException(text3, ex);
|
||||
}
|
||||
break;
|
||||
case X509FindType.FindByTimeValid:
|
||||
case X509FindType.FindByTimeNotYetValid:
|
||||
case X509FindType.FindByTimeExpired:
|
||||
try
|
||||
{
|
||||
dateTime = (DateTime)findValue;
|
||||
}
|
||||
catch (Exception ex2)
|
||||
{
|
||||
string text4 = global::Locale.GetText("Invalid find value type '{0}', expected '{1}'.", new object[]
|
||||
{
|
||||
findValue.GetType(),
|
||||
"X509DateTime"
|
||||
});
|
||||
throw new CryptographicException(text4, ex2);
|
||||
}
|
||||
break;
|
||||
case X509FindType.FindByApplicationPolicy:
|
||||
case X509FindType.FindByCertificatePolicy:
|
||||
case X509FindType.FindByExtension:
|
||||
try
|
||||
{
|
||||
text2 = (string)findValue;
|
||||
}
|
||||
catch (Exception ex3)
|
||||
{
|
||||
string text5 = global::Locale.GetText("Invalid find value type '{0}', expected '{1}'.", new object[]
|
||||
{
|
||||
findValue.GetType(),
|
||||
"X509KeyUsageFlags"
|
||||
});
|
||||
throw new CryptographicException(text5, ex3);
|
||||
}
|
||||
try
|
||||
{
|
||||
CryptoConfig.EncodeOID(text2);
|
||||
}
|
||||
catch (CryptographicUnexpectedOperationException)
|
||||
{
|
||||
string text6 = global::Locale.GetText("Invalid OID value '{0}'.", new object[] { text2 });
|
||||
throw new ArgumentException("findValue", text6);
|
||||
}
|
||||
break;
|
||||
case X509FindType.FindByKeyUsage:
|
||||
try
|
||||
{
|
||||
x509KeyUsageFlags = (X509KeyUsageFlags)((int)findValue);
|
||||
}
|
||||
catch (Exception ex4)
|
||||
{
|
||||
string text7 = global::Locale.GetText("Invalid find value type '{0}', expected '{1}'.", new object[]
|
||||
{
|
||||
findValue.GetType(),
|
||||
"X509KeyUsageFlags"
|
||||
});
|
||||
throw new CryptographicException(text7, ex4);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
string text8 = global::Locale.GetText("Invalid find type '{0}'.", new object[] { findType });
|
||||
throw new CryptographicException(text8);
|
||||
}
|
||||
}
|
||||
CultureInfo invariantCulture = CultureInfo.InvariantCulture;
|
||||
X509Certificate2Collection x509Certificate2Collection = new X509Certificate2Collection();
|
||||
foreach (object obj in base.InnerList)
|
||||
{
|
||||
X509Certificate2 x509Certificate = (X509Certificate2)obj;
|
||||
bool flag = false;
|
||||
switch (findType)
|
||||
{
|
||||
case X509FindType.FindByThumbprint:
|
||||
flag = string.Compare(text, x509Certificate.Thumbprint, true, invariantCulture) == 0 || string.Compare(text, x509Certificate.GetCertHashString(), true, invariantCulture) == 0;
|
||||
break;
|
||||
case X509FindType.FindBySubjectName:
|
||||
{
|
||||
string nameInfo = x509Certificate.GetNameInfo(X509NameType.SimpleName, false);
|
||||
flag = nameInfo.IndexOf(text, StringComparison.InvariantCultureIgnoreCase) >= 0;
|
||||
break;
|
||||
}
|
||||
case X509FindType.FindBySubjectDistinguishedName:
|
||||
flag = string.Compare(text, x509Certificate.Subject, true, invariantCulture) == 0;
|
||||
break;
|
||||
case X509FindType.FindByIssuerName:
|
||||
{
|
||||
string nameInfo2 = x509Certificate.GetNameInfo(X509NameType.SimpleName, true);
|
||||
flag = nameInfo2.IndexOf(text, StringComparison.InvariantCultureIgnoreCase) >= 0;
|
||||
break;
|
||||
}
|
||||
case X509FindType.FindByIssuerDistinguishedName:
|
||||
flag = string.Compare(text, x509Certificate.Issuer, true, invariantCulture) == 0;
|
||||
break;
|
||||
case X509FindType.FindBySerialNumber:
|
||||
flag = string.Compare(text, x509Certificate.SerialNumber, true, invariantCulture) == 0;
|
||||
break;
|
||||
case X509FindType.FindByTimeValid:
|
||||
flag = dateTime >= x509Certificate.NotBefore && dateTime <= x509Certificate.NotAfter;
|
||||
break;
|
||||
case X509FindType.FindByTimeNotYetValid:
|
||||
flag = dateTime < x509Certificate.NotBefore;
|
||||
break;
|
||||
case X509FindType.FindByTimeExpired:
|
||||
flag = dateTime > x509Certificate.NotAfter;
|
||||
break;
|
||||
case X509FindType.FindByApplicationPolicy:
|
||||
flag = x509Certificate.Extensions.Count == 0;
|
||||
break;
|
||||
case X509FindType.FindByExtension:
|
||||
flag = x509Certificate.Extensions[text2] != null;
|
||||
break;
|
||||
case X509FindType.FindByKeyUsage:
|
||||
{
|
||||
X509KeyUsageExtension x509KeyUsageExtension = x509Certificate.Extensions["2.5.29.15"] as X509KeyUsageExtension;
|
||||
flag = x509KeyUsageExtension == null || (x509KeyUsageExtension.KeyUsages & x509KeyUsageFlags) == x509KeyUsageFlags;
|
||||
break;
|
||||
}
|
||||
case X509FindType.FindBySubjectKeyIdentifier:
|
||||
{
|
||||
X509SubjectKeyIdentifierExtension x509SubjectKeyIdentifierExtension = x509Certificate.Extensions["2.5.29.14"] as X509SubjectKeyIdentifierExtension;
|
||||
if (x509SubjectKeyIdentifierExtension != null)
|
||||
{
|
||||
flag = string.Compare(text, x509SubjectKeyIdentifierExtension.SubjectKeyIdentifier, true, invariantCulture) == 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
if (validOnly)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (x509Certificate.Verify())
|
||||
{
|
||||
x509Certificate2Collection.Add(x509Certificate);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
x509Certificate2Collection.Add(x509Certificate);
|
||||
}
|
||||
}
|
||||
}
|
||||
return x509Certificate2Collection;
|
||||
}
|
||||
|
||||
/// <summary>Returns an enumerator that can iterate through a <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> object.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Enumerator" /> object that can iterate through the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> object.</returns>
|
||||
// Token: 0x060017DD RID: 6109 RVA: 0x00050A58 File Offset: 0x0004EC58
|
||||
public new X509Certificate2Enumerator GetEnumerator()
|
||||
{
|
||||
return new X509Certificate2Enumerator(this);
|
||||
}
|
||||
|
||||
/// <summary>Imports a certificate in the form of a byte array into a <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> object.</summary>
|
||||
/// <param name="rawData">A byte array containing data from an X.509 certificate. </param>
|
||||
// Token: 0x060017DE RID: 6110 RVA: 0x00050A60 File Offset: 0x0004EC60
|
||||
[global::System.MonoTODO("same limitations as X509Certificate2.Import")]
|
||||
public void Import(byte[] rawData)
|
||||
{
|
||||
X509Certificate2 x509Certificate = new X509Certificate2();
|
||||
x509Certificate.Import(rawData);
|
||||
this.Add(x509Certificate);
|
||||
}
|
||||
|
||||
/// <summary>Imports a certificate, in the form of a byte array that requires a password to access the certificate, into a <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> object.</summary>
|
||||
/// <param name="rawData">A byte array containing data from an <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> object. </param>
|
||||
/// <param name="password">The password required to access the certificate information. </param>
|
||||
/// <param name="keyStorageFlags">One of the <see cref="T:System.Security.Cryptography.X509Certificates.X509KeyStorageFlags" /> values that controls how and where the private key is imported. </param>
|
||||
// Token: 0x060017DF RID: 6111 RVA: 0x00050A84 File Offset: 0x0004EC84
|
||||
[global::System.MonoTODO("same limitations as X509Certificate2.Import")]
|
||||
public void Import(byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags)
|
||||
{
|
||||
X509Certificate2 x509Certificate = new X509Certificate2();
|
||||
x509Certificate.Import(rawData, password, keyStorageFlags);
|
||||
this.Add(x509Certificate);
|
||||
}
|
||||
|
||||
/// <summary>Imports a certificate file into a <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> object.</summary>
|
||||
/// <param name="fileName">The name of the file containing the certificate information. </param>
|
||||
// Token: 0x060017E0 RID: 6112 RVA: 0x00050AA8 File Offset: 0x0004ECA8
|
||||
[global::System.MonoTODO("same limitations as X509Certificate2.Import")]
|
||||
public void Import(string fileName)
|
||||
{
|
||||
X509Certificate2 x509Certificate = new X509Certificate2();
|
||||
x509Certificate.Import(fileName);
|
||||
this.Add(x509Certificate);
|
||||
}
|
||||
|
||||
/// <summary>Imports a certificate file that requires a password into a <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> object.</summary>
|
||||
/// <param name="fileName">The name of the file containing the certificate information. </param>
|
||||
/// <param name="password">The password required to access the certificate information. </param>
|
||||
/// <param name="keyStorageFlags">One of the <see cref="T:System.Security.Cryptography.X509Certificates.X509KeyStorageFlags" /> values that controls how and where the private key is imported. </param>
|
||||
// Token: 0x060017E1 RID: 6113 RVA: 0x00050ACC File Offset: 0x0004ECCC
|
||||
[global::System.MonoTODO("same limitations as X509Certificate2.Import")]
|
||||
public void Import(string fileName, string password, X509KeyStorageFlags keyStorageFlags)
|
||||
{
|
||||
X509Certificate2 x509Certificate = new X509Certificate2();
|
||||
x509Certificate.Import(fileName, password, keyStorageFlags);
|
||||
this.Add(x509Certificate);
|
||||
}
|
||||
|
||||
/// <summary>Inserts an object into the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> object at the specified index.</summary>
|
||||
/// <param name="index">The zero-based index at which to insert <paramref name="certificate" />. </param>
|
||||
/// <param name="certificate">The <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> object to insert. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> is less than zero.-or- <paramref name="index" /> is greater than the <see cref="P:System.Collections.CollectionBase.Count" /> property. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The collection is read-only.-or- The collection has a fixed size. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="certificate" /> is null. </exception>
|
||||
// Token: 0x060017E2 RID: 6114 RVA: 0x00050AF0 File Offset: 0x0004ECF0
|
||||
public void Insert(int index, X509Certificate2 certificate)
|
||||
{
|
||||
if (certificate == null)
|
||||
{
|
||||
throw new ArgumentNullException("certificate");
|
||||
}
|
||||
if (index < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("negative index");
|
||||
}
|
||||
if (index >= base.InnerList.Count)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index >= Count");
|
||||
}
|
||||
base.InnerList.Insert(index, certificate);
|
||||
}
|
||||
|
||||
/// <summary>Removes the first occurrence of a certificate from the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> object.</summary>
|
||||
/// <param name="certificate">The <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> object to be removed from the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> object. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="certificate" /> is null. </exception>
|
||||
// Token: 0x060017E3 RID: 6115 RVA: 0x00050B4C File Offset: 0x0004ED4C
|
||||
public void Remove(X509Certificate2 certificate)
|
||||
{
|
||||
if (certificate == null)
|
||||
{
|
||||
throw new ArgumentNullException("certificate");
|
||||
}
|
||||
for (int i = 0; i < base.InnerList.Count; i++)
|
||||
{
|
||||
X509Certificate x509Certificate = (X509Certificate)base.InnerList[i];
|
||||
if (x509Certificate.Equals(certificate))
|
||||
{
|
||||
base.InnerList.RemoveAt(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Removes multiple <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> objects in an array from an <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> object.</summary>
|
||||
/// <param name="certificates">An array of <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> objects. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="certificates" /> is null. </exception>
|
||||
// Token: 0x060017E4 RID: 6116 RVA: 0x00050BB4 File Offset: 0x0004EDB4
|
||||
[global::System.MonoTODO("Method isn't transactional (like documented)")]
|
||||
public void RemoveRange(X509Certificate2[] certificates)
|
||||
{
|
||||
if (certificates == null)
|
||||
{
|
||||
throw new ArgumentNullException("certificate");
|
||||
}
|
||||
foreach (X509Certificate2 x509Certificate in certificates)
|
||||
{
|
||||
this.Remove(x509Certificate);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Removes multiple <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> objects in an <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> object from another <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> object.</summary>
|
||||
/// <param name="certificates">An <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> object. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="certificates" /> is null. </exception>
|
||||
// Token: 0x060017E5 RID: 6117 RVA: 0x00050BF4 File Offset: 0x0004EDF4
|
||||
[global::System.MonoTODO("Method isn't transactional (like documented)")]
|
||||
public void RemoveRange(X509Certificate2Collection certificates)
|
||||
{
|
||||
if (certificates == null)
|
||||
{
|
||||
throw new ArgumentNullException("certificate");
|
||||
}
|
||||
foreach (X509Certificate2 x509Certificate in certificates)
|
||||
{
|
||||
this.Remove(x509Certificate);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Supports a simple iteration over a <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> object. This class cannot be inherited.</summary>
|
||||
// Token: 0x0200028A RID: 650
|
||||
public sealed class X509Certificate2Enumerator : IEnumerator
|
||||
{
|
||||
// Token: 0x060017E6 RID: 6118 RVA: 0x00050C38 File Offset: 0x0004EE38
|
||||
internal X509Certificate2Enumerator(X509Certificate2Collection collection)
|
||||
{
|
||||
this.enumerator = ((IEnumerable)collection).GetEnumerator();
|
||||
}
|
||||
|
||||
/// <summary>For a description of this member, see <see cref="P:System.Collections.IEnumerator.Current" />.</summary>
|
||||
/// <returns>The current element in the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> object.</returns>
|
||||
/// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element. </exception>
|
||||
// Token: 0x17000788 RID: 1928
|
||||
// (get) Token: 0x060017E7 RID: 6119 RVA: 0x00050C4C File Offset: 0x0004EE4C
|
||||
object IEnumerator.Current
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.enumerator.Current;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>For a description of this member, see <see cref="M:System.Collections.IEnumerator.MoveNext" />.</summary>
|
||||
/// <returns>true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.</returns>
|
||||
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception>
|
||||
// Token: 0x060017E8 RID: 6120 RVA: 0x00050C5C File Offset: 0x0004EE5C
|
||||
bool IEnumerator.MoveNext()
|
||||
{
|
||||
return this.enumerator.MoveNext();
|
||||
}
|
||||
|
||||
/// <summary>For a description of this member, see <see cref="M:System.Collections.IEnumerator.Reset" />.</summary>
|
||||
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception>
|
||||
// Token: 0x060017E9 RID: 6121 RVA: 0x00050C6C File Offset: 0x0004EE6C
|
||||
void IEnumerator.Reset()
|
||||
{
|
||||
this.enumerator.Reset();
|
||||
}
|
||||
|
||||
/// <summary>Gets the current element in the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> object.</summary>
|
||||
/// <returns>The current element in the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> object.</returns>
|
||||
/// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element. </exception>
|
||||
// Token: 0x17000789 RID: 1929
|
||||
// (get) Token: 0x060017EA RID: 6122 RVA: 0x00050C7C File Offset: 0x0004EE7C
|
||||
public X509Certificate2 Current
|
||||
{
|
||||
get
|
||||
{
|
||||
return (X509Certificate2)this.enumerator.Current;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Advances the enumerator to the next element in the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> object.</summary>
|
||||
/// <returns>true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.</returns>
|
||||
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception>
|
||||
// Token: 0x060017EB RID: 6123 RVA: 0x00050C90 File Offset: 0x0004EE90
|
||||
public bool MoveNext()
|
||||
{
|
||||
return this.enumerator.MoveNext();
|
||||
}
|
||||
|
||||
/// <summary>Sets the enumerator to its initial position, which is before the first element in the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> object.</summary>
|
||||
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception>
|
||||
// Token: 0x060017EC RID: 6124 RVA: 0x00050CA0 File Offset: 0x0004EEA0
|
||||
public void Reset()
|
||||
{
|
||||
this.enumerator.Reset();
|
||||
}
|
||||
|
||||
// Token: 0x04001305 RID: 4869
|
||||
private IEnumerator enumerator;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,281 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Defines a collection that stores <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> objects.</summary>
|
||||
// Token: 0x0200028B RID: 651
|
||||
[Serializable]
|
||||
public class X509CertificateCollection : CollectionBase
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" /> class.</summary>
|
||||
// Token: 0x060017ED RID: 6125 RVA: 0x00050CB0 File Offset: 0x0004EEB0
|
||||
public X509CertificateCollection()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" /> class from an array of <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> objects.</summary>
|
||||
/// <param name="value">The array of <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> objects with which to initialize the new object. </param>
|
||||
// Token: 0x060017EE RID: 6126 RVA: 0x00050CB8 File Offset: 0x0004EEB8
|
||||
public X509CertificateCollection(X509Certificate[] value)
|
||||
{
|
||||
this.AddRange(value);
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" /> class from another <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" />.</summary>
|
||||
/// <param name="value">The <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" /> with which to initialize the new object. </param>
|
||||
// Token: 0x060017EF RID: 6127 RVA: 0x00050CC8 File Offset: 0x0004EEC8
|
||||
public X509CertificateCollection(X509CertificateCollection value)
|
||||
{
|
||||
this.AddRange(value);
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the entry at the specified index of the current <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" />.</summary>
|
||||
/// <returns>The <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> at the specified index of the current <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" />.</returns>
|
||||
/// <param name="index">The zero-based index of the entry to locate in the current <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" />. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="index" /> parameter is outside the valid range of indexes for the collection. </exception>
|
||||
// Token: 0x1700078A RID: 1930
|
||||
public X509Certificate this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return (X509Certificate)base.InnerList[index];
|
||||
}
|
||||
set
|
||||
{
|
||||
base.InnerList[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Adds an <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> with the specified value to the current <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" />.</summary>
|
||||
/// <returns>The index into the current <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" /> at which the new <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> was inserted.</returns>
|
||||
/// <param name="value">The <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> to add to the current <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" />. </param>
|
||||
// Token: 0x060017F2 RID: 6130 RVA: 0x00050CFC File Offset: 0x0004EEFC
|
||||
public int Add(X509Certificate value)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("value");
|
||||
}
|
||||
return base.InnerList.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>Copies the elements of an array of type <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> to the end of the current <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" />.</summary>
|
||||
/// <param name="value">The array of type <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> containing the objects to add to the current <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" />. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="value" /> parameter is null. </exception>
|
||||
// Token: 0x060017F3 RID: 6131 RVA: 0x00050D1C File Offset: 0x0004EF1C
|
||||
public void AddRange(X509Certificate[] value)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("value");
|
||||
}
|
||||
for (int i = 0; i < value.Length; i++)
|
||||
{
|
||||
base.InnerList.Add(value[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Copies the elements of the specified <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" /> to the end of the current <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" />.</summary>
|
||||
/// <param name="value">The <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" /> containing the objects to add to the collection. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="value" /> parameter is null. </exception>
|
||||
// Token: 0x060017F4 RID: 6132 RVA: 0x00050D60 File Offset: 0x0004EF60
|
||||
public void AddRange(X509CertificateCollection value)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("value");
|
||||
}
|
||||
for (int i = 0; i < value.InnerList.Count; i++)
|
||||
{
|
||||
base.InnerList.Add(value[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a value indicating whether the current <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" /> contains the specified <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" />.</summary>
|
||||
/// <returns>true if the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> is contained in this collection; otherwise, false.</returns>
|
||||
/// <param name="value">The <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> to locate. </param>
|
||||
// Token: 0x060017F5 RID: 6133 RVA: 0x00050DB0 File Offset: 0x0004EFB0
|
||||
public bool Contains(X509Certificate value)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
byte[] certHash = value.GetCertHash();
|
||||
for (int i = 0; i < base.InnerList.Count; i++)
|
||||
{
|
||||
X509Certificate x509Certificate = (X509Certificate)base.InnerList[i];
|
||||
if (this.Compare(x509Certificate.GetCertHash(), certHash))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>Copies the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> values in the current <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" /> to a one-dimensional <see cref="T:System.Array" /> instance at the specified index.</summary>
|
||||
/// <param name="array">The one-dimensional <see cref="T:System.Array" /> that is the destination of the values copied from <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" />. </param>
|
||||
/// <param name="index">The index into <paramref name="array" /> to begin copying. </param>
|
||||
/// <exception cref="T:System.ArgumentException">The <paramref name="array" /> parameter is multidimensional.-or- The number of elements in the <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" /> is greater than the available space between <paramref name="arrayIndex" /> and the end of <paramref name="array" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="array" /> parameter is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="arrayIndex" /> parameter is less than the <paramref name="array" /> parameter's lower bound. </exception>
|
||||
// Token: 0x060017F6 RID: 6134 RVA: 0x00050E10 File Offset: 0x0004F010
|
||||
public void CopyTo(X509Certificate[] array, int index)
|
||||
{
|
||||
base.InnerList.CopyTo(array, index);
|
||||
}
|
||||
|
||||
/// <summary>Returns an enumerator that can iterate through the <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" />.</summary>
|
||||
/// <returns>An enumerator of the subelements of <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" /> you can use to iterate through the collection.</returns>
|
||||
// Token: 0x060017F7 RID: 6135 RVA: 0x00050E20 File Offset: 0x0004F020
|
||||
public new X509CertificateCollection.X509CertificateEnumerator GetEnumerator()
|
||||
{
|
||||
return new X509CertificateCollection.X509CertificateEnumerator(this);
|
||||
}
|
||||
|
||||
/// <summary>Builds a hash value based on all values contained in the current <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" />.</summary>
|
||||
/// <returns>A hash value based on all values contained in the current <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" />.</returns>
|
||||
// Token: 0x060017F8 RID: 6136 RVA: 0x00050E28 File Offset: 0x0004F028
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.InnerList.GetHashCode();
|
||||
}
|
||||
|
||||
/// <summary>Returns the index of the specified <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> in the current <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" />.</summary>
|
||||
/// <returns>The index of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> specified by the <paramref name="value" /> parameter in the <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" />, if found; otherwise, -1.</returns>
|
||||
/// <param name="value">The <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> to locate. </param>
|
||||
// Token: 0x060017F9 RID: 6137 RVA: 0x00050E38 File Offset: 0x0004F038
|
||||
public int IndexOf(X509Certificate value)
|
||||
{
|
||||
return base.InnerList.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>Inserts a <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> into the current <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" /> at the specified index.</summary>
|
||||
/// <param name="index">The zero-based index where <paramref name="value" /> should be inserted. </param>
|
||||
/// <param name="value">The <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> to insert. </param>
|
||||
// Token: 0x060017FA RID: 6138 RVA: 0x00050E48 File Offset: 0x0004F048
|
||||
public void Insert(int index, X509Certificate value)
|
||||
{
|
||||
base.InnerList.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>Removes a specific <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> from the current <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" />.</summary>
|
||||
/// <param name="value">The <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> to remove from the current <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" />. </param>
|
||||
/// <exception cref="T:System.ArgumentException">The <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> specified by the <paramref name="value" /> parameter is not found in the current <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" />. </exception>
|
||||
// Token: 0x060017FB RID: 6139 RVA: 0x00050E58 File Offset: 0x0004F058
|
||||
public void Remove(X509Certificate value)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("value");
|
||||
}
|
||||
if (this.IndexOf(value) == -1)
|
||||
{
|
||||
throw new ArgumentException("value", global::Locale.GetText("Not part of the collection."));
|
||||
}
|
||||
base.InnerList.Remove(value);
|
||||
}
|
||||
|
||||
// Token: 0x060017FC RID: 6140 RVA: 0x00050EA4 File Offset: 0x0004F0A4
|
||||
private bool Compare(byte[] array1, byte[] array2)
|
||||
{
|
||||
if (array1 == null && array2 == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (array1 == null || array2 == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (array1.Length != array2.Length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < array1.Length; i++)
|
||||
{
|
||||
if (array1[i] != array2[i])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>Enumerates the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> objects in an <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" />.</summary>
|
||||
// Token: 0x0200028C RID: 652
|
||||
public class X509CertificateEnumerator : IEnumerator
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection.X509CertificateEnumerator" /> class for the specified <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" />.</summary>
|
||||
/// <param name="mappings">The <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" /> to enumerate. </param>
|
||||
// Token: 0x060017FD RID: 6141 RVA: 0x00050EFC File Offset: 0x0004F0FC
|
||||
public X509CertificateEnumerator(X509CertificateCollection mappings)
|
||||
{
|
||||
this.enumerator = ((IEnumerable)mappings).GetEnumerator();
|
||||
}
|
||||
|
||||
/// <summary>For a description of this member, see <see cref="P:System.Collections.IEnumerator.Current" />.</summary>
|
||||
/// <returns>The current X.509 certificate object in the <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" /> object.</returns>
|
||||
/// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element. </exception>
|
||||
// Token: 0x1700078B RID: 1931
|
||||
// (get) Token: 0x060017FE RID: 6142 RVA: 0x00050F10 File Offset: 0x0004F110
|
||||
object IEnumerator.Current
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.enumerator.Current;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>For a description of this member, see <see cref="M:System.Collections.IEnumerator.MoveNext" />.</summary>
|
||||
/// <returns>true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.</returns>
|
||||
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was instantiated. </exception>
|
||||
// Token: 0x060017FF RID: 6143 RVA: 0x00050F20 File Offset: 0x0004F120
|
||||
bool IEnumerator.MoveNext()
|
||||
{
|
||||
return this.enumerator.MoveNext();
|
||||
}
|
||||
|
||||
/// <summary>For a description of this member, see <see cref="M:System.Collections.IEnumerator.Reset" />.</summary>
|
||||
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was instantiated. </exception>
|
||||
// Token: 0x06001800 RID: 6144 RVA: 0x00050F30 File Offset: 0x0004F130
|
||||
void IEnumerator.Reset()
|
||||
{
|
||||
this.enumerator.Reset();
|
||||
}
|
||||
|
||||
/// <summary>Gets the current <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> in the <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" />.</summary>
|
||||
/// <returns>The current <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> in the <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" />.</returns>
|
||||
/// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element. </exception>
|
||||
// Token: 0x1700078C RID: 1932
|
||||
// (get) Token: 0x06001801 RID: 6145 RVA: 0x00050F40 File Offset: 0x0004F140
|
||||
public X509Certificate Current
|
||||
{
|
||||
get
|
||||
{
|
||||
return (X509Certificate)this.enumerator.Current;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Advances the enumerator to the next element of the collection.</summary>
|
||||
/// <returns>true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.</returns>
|
||||
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was instantiated. </exception>
|
||||
// Token: 0x06001802 RID: 6146 RVA: 0x00050F54 File Offset: 0x0004F154
|
||||
public bool MoveNext()
|
||||
{
|
||||
return this.enumerator.MoveNext();
|
||||
}
|
||||
|
||||
/// <summary>Sets the enumerator to its initial position, which is before the first element in the collection.</summary>
|
||||
/// <exception cref="T:System.InvalidOperationException">The collection is modified after the enumerator is instantiated. </exception>
|
||||
// Token: 0x06001803 RID: 6147 RVA: 0x00050F64 File Offset: 0x0004F164
|
||||
public void Reset()
|
||||
{
|
||||
this.enumerator.Reset();
|
||||
}
|
||||
|
||||
// Token: 0x04001306 RID: 4870
|
||||
private IEnumerator enumerator;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,871 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Mono.Security.X509;
|
||||
using Mono.Security.X509.Extensions;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Represents a chain-building engine for <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> certificates.</summary>
|
||||
// Token: 0x0200028D RID: 653
|
||||
public class X509Chain
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Chain" /> class.</summary>
|
||||
// Token: 0x06001804 RID: 6148 RVA: 0x00050F74 File Offset: 0x0004F174
|
||||
public X509Chain()
|
||||
: this(false)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Chain" /> class specifying a value that indicates whether the machine context should be used.</summary>
|
||||
/// <param name="useMachineContext">true to use the machine context; false to use the current user context. </param>
|
||||
// Token: 0x06001805 RID: 6149 RVA: 0x00050F80 File Offset: 0x0004F180
|
||||
public X509Chain(bool useMachineContext)
|
||||
{
|
||||
this.location = ((!useMachineContext) ? StoreLocation.CurrentUser : StoreLocation.LocalMachine);
|
||||
this.elements = new X509ChainElementCollection();
|
||||
this.policy = new X509ChainPolicy();
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Chain" /> class using an <see cref="T:System.IntPtr" /> handle to an X.509 chain.</summary>
|
||||
/// <param name="chainContext">An <see cref="T:System.IntPtr" /> handle to an X.509 chain.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="chainContext" /> parameter is null.</exception>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The <paramref name="chainContext" /> parameter points to an invalid context.</exception>
|
||||
// Token: 0x06001806 RID: 6150 RVA: 0x00050FB4 File Offset: 0x0004F1B4
|
||||
[global::System.MonoTODO("Mono's X509Chain is fully managed. All handles are invalid.")]
|
||||
public X509Chain(IntPtr chainContext)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
/// <summary>Gets a handle to an X.509 chain.</summary>
|
||||
/// <returns>An <see cref="T:System.IntPtr" /> handle to an X.509 chain.</returns>
|
||||
// Token: 0x1700078D RID: 1933
|
||||
// (get) Token: 0x06001808 RID: 6152 RVA: 0x00050FD4 File Offset: 0x0004F1D4
|
||||
[global::System.MonoTODO("Mono's X509Chain is fully managed. Always returns IntPtr.Zero.")]
|
||||
public IntPtr ChainContext
|
||||
{
|
||||
get
|
||||
{
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a collection of <see cref="T:System.Security.Cryptography.X509Certificates.X509ChainElement" /> objects.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.X509Certificates.X509ChainElementCollection" /> object.</returns>
|
||||
// Token: 0x1700078E RID: 1934
|
||||
// (get) Token: 0x06001809 RID: 6153 RVA: 0x00050FDC File Offset: 0x0004F1DC
|
||||
public X509ChainElementCollection ChainElements
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.elements;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the <see cref="T:System.Security.Cryptography.X509Certificates.X509ChainPolicy" /> to use when building an X.509 certificate chain.</summary>
|
||||
/// <returns>The <see cref="T:System.Security.Cryptography.X509Certificates.X509ChainPolicy" /> object associated with this X.509 chain.</returns>
|
||||
/// <exception cref="T:System.ArgumentNullException">The value being set for this property is null.</exception>
|
||||
// Token: 0x1700078F RID: 1935
|
||||
// (get) Token: 0x0600180A RID: 6154 RVA: 0x00050FE4 File Offset: 0x0004F1E4
|
||||
// (set) Token: 0x0600180B RID: 6155 RVA: 0x00050FEC File Offset: 0x0004F1EC
|
||||
public X509ChainPolicy ChainPolicy
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.policy;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.policy = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the status of each element in an <see cref="T:System.Security.Cryptography.X509Certificates.X509Chain" /> object.</summary>
|
||||
/// <returns>An array of <see cref="T:System.Security.Cryptography.X509Certificates.X509ChainStatus" /> objects.</returns>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x17000790 RID: 1936
|
||||
// (get) Token: 0x0600180C RID: 6156 RVA: 0x00050FF8 File Offset: 0x0004F1F8
|
||||
public X509ChainStatus[] ChainStatus
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.status == null)
|
||||
{
|
||||
return X509Chain.Empty;
|
||||
}
|
||||
return this.status;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Builds an X.509 chain using the policy specified in <see cref="T:System.Security.Cryptography.X509Certificates.X509ChainPolicy" />.</summary>
|
||||
/// <returns>true if the X.509 certificate is valid; otherwise, false.</returns>
|
||||
/// <param name="certificate">An <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> object.</param>
|
||||
/// <exception cref="T:System.ArgumentException">The <paramref name="certificate" /> is not a valid certificate or is null. </exception>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The <paramref name="certificate" /> is unreadable. </exception>
|
||||
// Token: 0x0600180D RID: 6157 RVA: 0x00051014 File Offset: 0x0004F214
|
||||
[global::System.MonoTODO("Not totally RFC3280 compliant, but neither is MS implementation...")]
|
||||
public bool Build(X509Certificate2 certificate)
|
||||
{
|
||||
if (certificate == null)
|
||||
{
|
||||
throw new ArgumentException("certificate");
|
||||
}
|
||||
this.Reset();
|
||||
X509ChainStatusFlags x509ChainStatusFlags;
|
||||
try
|
||||
{
|
||||
x509ChainStatusFlags = this.BuildChainFrom(certificate);
|
||||
this.ValidateChain(x509ChainStatusFlags);
|
||||
}
|
||||
catch (CryptographicException ex)
|
||||
{
|
||||
throw new ArgumentException("certificate", ex);
|
||||
}
|
||||
X509ChainStatusFlags x509ChainStatusFlags2 = X509ChainStatusFlags.NoError;
|
||||
ArrayList arrayList = new ArrayList();
|
||||
foreach (X509ChainElement x509ChainElement in this.elements)
|
||||
{
|
||||
foreach (X509ChainStatus x509ChainStatus in x509ChainElement.ChainElementStatus)
|
||||
{
|
||||
if ((x509ChainStatusFlags2 & x509ChainStatus.Status) != x509ChainStatus.Status)
|
||||
{
|
||||
arrayList.Add(x509ChainStatus);
|
||||
x509ChainStatusFlags2 |= x509ChainStatus.Status;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (x509ChainStatusFlags != X509ChainStatusFlags.NoError)
|
||||
{
|
||||
arrayList.Insert(0, new X509ChainStatus(x509ChainStatusFlags));
|
||||
}
|
||||
this.status = (X509ChainStatus[])arrayList.ToArray(typeof(X509ChainStatus));
|
||||
if (this.status.Length == 0 || this.ChainPolicy.VerificationFlags == X509VerificationFlags.AllFlags)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool flag = true;
|
||||
foreach (X509ChainStatus x509ChainStatus2 in this.status)
|
||||
{
|
||||
X509ChainStatusFlags x509ChainStatusFlags3 = x509ChainStatus2.Status;
|
||||
if (x509ChainStatusFlags3 != X509ChainStatusFlags.NotTimeValid)
|
||||
{
|
||||
if (x509ChainStatusFlags3 != X509ChainStatusFlags.NotTimeNested)
|
||||
{
|
||||
if (x509ChainStatusFlags3 != X509ChainStatusFlags.UntrustedRoot)
|
||||
{
|
||||
if (x509ChainStatusFlags3 != X509ChainStatusFlags.InvalidExtension)
|
||||
{
|
||||
if (x509ChainStatusFlags3 != X509ChainStatusFlags.InvalidPolicyConstraints)
|
||||
{
|
||||
if (x509ChainStatusFlags3 == X509ChainStatusFlags.InvalidBasicConstraints)
|
||||
{
|
||||
flag &= (this.ChainPolicy.VerificationFlags & X509VerificationFlags.IgnoreInvalidBasicConstraints) != X509VerificationFlags.NoFlag;
|
||||
goto IL_316;
|
||||
}
|
||||
if (x509ChainStatusFlags3 == X509ChainStatusFlags.InvalidNameConstraints || x509ChainStatusFlags3 == X509ChainStatusFlags.HasNotSupportedNameConstraint || x509ChainStatusFlags3 == X509ChainStatusFlags.HasNotPermittedNameConstraint || x509ChainStatusFlags3 == X509ChainStatusFlags.HasExcludedNameConstraint)
|
||||
{
|
||||
flag &= (this.ChainPolicy.VerificationFlags & X509VerificationFlags.IgnoreInvalidName) != X509VerificationFlags.NoFlag;
|
||||
goto IL_316;
|
||||
}
|
||||
if (x509ChainStatusFlags3 == X509ChainStatusFlags.PartialChain)
|
||||
{
|
||||
goto IL_1FC;
|
||||
}
|
||||
if (x509ChainStatusFlags3 == X509ChainStatusFlags.CtlNotTimeValid)
|
||||
{
|
||||
flag &= (this.ChainPolicy.VerificationFlags & X509VerificationFlags.IgnoreCtlNotTimeValid) != X509VerificationFlags.NoFlag;
|
||||
goto IL_316;
|
||||
}
|
||||
if (x509ChainStatusFlags3 == X509ChainStatusFlags.CtlNotSignatureValid)
|
||||
{
|
||||
goto IL_316;
|
||||
}
|
||||
if (x509ChainStatusFlags3 == X509ChainStatusFlags.CtlNotValidForUsage)
|
||||
{
|
||||
flag &= (this.ChainPolicy.VerificationFlags & X509VerificationFlags.IgnoreWrongUsage) != X509VerificationFlags.NoFlag;
|
||||
goto IL_316;
|
||||
}
|
||||
if (x509ChainStatusFlags3 != X509ChainStatusFlags.NoIssuanceChainPolicy)
|
||||
{
|
||||
flag = false;
|
||||
goto IL_316;
|
||||
}
|
||||
}
|
||||
flag &= (this.ChainPolicy.VerificationFlags & X509VerificationFlags.IgnoreInvalidPolicy) != X509VerificationFlags.NoFlag;
|
||||
goto IL_316;
|
||||
}
|
||||
flag &= (this.ChainPolicy.VerificationFlags & X509VerificationFlags.IgnoreWrongUsage) != X509VerificationFlags.NoFlag;
|
||||
goto IL_316;
|
||||
}
|
||||
IL_1FC:
|
||||
flag &= (this.ChainPolicy.VerificationFlags & X509VerificationFlags.AllowUnknownCertificateAuthority) != X509VerificationFlags.NoFlag;
|
||||
}
|
||||
else
|
||||
{
|
||||
flag &= (this.ChainPolicy.VerificationFlags & X509VerificationFlags.IgnoreNotTimeNested) != X509VerificationFlags.NoFlag;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
flag &= (this.ChainPolicy.VerificationFlags & X509VerificationFlags.IgnoreNotTimeValid) != X509VerificationFlags.NoFlag;
|
||||
}
|
||||
IL_316:
|
||||
if (!flag)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>Clears the current <see cref="T:System.Security.Cryptography.X509Certificates.X509Chain" /> object.</summary>
|
||||
// Token: 0x0600180E RID: 6158 RVA: 0x00051370 File Offset: 0x0004F570
|
||||
public void Reset()
|
||||
{
|
||||
if (this.status != null && this.status.Length != 0)
|
||||
{
|
||||
this.status = null;
|
||||
}
|
||||
if (this.elements.Count > 0)
|
||||
{
|
||||
this.elements.Clear();
|
||||
}
|
||||
if (this.roots != null)
|
||||
{
|
||||
this.roots.Close();
|
||||
this.roots = null;
|
||||
}
|
||||
if (this.cas != null)
|
||||
{
|
||||
this.cas.Close();
|
||||
this.cas = null;
|
||||
}
|
||||
this.collection = null;
|
||||
this.bce_restriction = null;
|
||||
this.working_public_key = null;
|
||||
}
|
||||
|
||||
/// <summary>Creates an <see cref="T:System.Security.Cryptography.X509Certificates.X509Chain" /> object after querying for the mapping defined in the CryptoConfig file, and maps the chain to that mapping.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.X509Certificates.X509Chain" /> object.</returns>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600180F RID: 6159 RVA: 0x00051408 File Offset: 0x0004F608
|
||||
public static X509Chain Create()
|
||||
{
|
||||
return (X509Chain)CryptoConfig.CreateFromName("X509Chain");
|
||||
}
|
||||
|
||||
// Token: 0x17000791 RID: 1937
|
||||
// (get) Token: 0x06001810 RID: 6160 RVA: 0x0005141C File Offset: 0x0004F61C
|
||||
private X509Store Roots
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.roots == null)
|
||||
{
|
||||
this.roots = new X509Store(StoreName.Root, this.location);
|
||||
this.roots.Open(OpenFlags.ReadOnly);
|
||||
}
|
||||
return this.roots;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000792 RID: 1938
|
||||
// (get) Token: 0x06001811 RID: 6161 RVA: 0x00051450 File Offset: 0x0004F650
|
||||
private X509Store CertificateAuthorities
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.cas == null)
|
||||
{
|
||||
this.cas = new X509Store(StoreName.CertificateAuthority, this.location);
|
||||
this.cas.Open(OpenFlags.ReadOnly);
|
||||
}
|
||||
return this.cas;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000793 RID: 1939
|
||||
// (get) Token: 0x06001812 RID: 6162 RVA: 0x00051484 File Offset: 0x0004F684
|
||||
private X509Certificate2Collection CertificateCollection
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.collection == null)
|
||||
{
|
||||
this.collection = new X509Certificate2Collection(this.ChainPolicy.ExtraStore);
|
||||
if (this.Roots.Certificates.Count > 0)
|
||||
{
|
||||
this.collection.AddRange(this.Roots.Certificates);
|
||||
}
|
||||
if (this.CertificateAuthorities.Certificates.Count > 0)
|
||||
{
|
||||
this.collection.AddRange(this.CertificateAuthorities.Certificates);
|
||||
}
|
||||
}
|
||||
return this.collection;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001813 RID: 6163 RVA: 0x00051510 File Offset: 0x0004F710
|
||||
private X509ChainStatusFlags BuildChainFrom(X509Certificate2 certificate)
|
||||
{
|
||||
this.elements.Add(certificate);
|
||||
while (!this.IsChainComplete(certificate))
|
||||
{
|
||||
certificate = this.FindParent(certificate);
|
||||
if (certificate == null)
|
||||
{
|
||||
return X509ChainStatusFlags.PartialChain;
|
||||
}
|
||||
if (this.elements.Contains(certificate))
|
||||
{
|
||||
return X509ChainStatusFlags.Cyclic;
|
||||
}
|
||||
this.elements.Add(certificate);
|
||||
}
|
||||
if (!this.Roots.Certificates.Contains(certificate))
|
||||
{
|
||||
this.elements[this.elements.Count - 1].StatusFlags |= X509ChainStatusFlags.UntrustedRoot;
|
||||
}
|
||||
return X509ChainStatusFlags.NoError;
|
||||
}
|
||||
|
||||
// Token: 0x06001814 RID: 6164 RVA: 0x000515B0 File Offset: 0x0004F7B0
|
||||
private X509Certificate2 SelectBestFromCollection(X509Certificate2 child, X509Certificate2Collection c)
|
||||
{
|
||||
int count = c.Count;
|
||||
if (count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (count == 1)
|
||||
{
|
||||
return c[0];
|
||||
}
|
||||
X509Certificate2Collection x509Certificate2Collection = c.Find(X509FindType.FindByTimeValid, this.ChainPolicy.VerificationTime, false);
|
||||
int count2 = x509Certificate2Collection.Count;
|
||||
if (count2 != 0)
|
||||
{
|
||||
if (count2 == 1)
|
||||
{
|
||||
return x509Certificate2Collection[0];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
x509Certificate2Collection = c;
|
||||
}
|
||||
string authorityKeyIdentifier = this.GetAuthorityKeyIdentifier(child);
|
||||
if (string.IsNullOrEmpty(authorityKeyIdentifier))
|
||||
{
|
||||
return x509Certificate2Collection[0];
|
||||
}
|
||||
foreach (X509Certificate2 x509Certificate in x509Certificate2Collection)
|
||||
{
|
||||
string subjectKeyIdentifier = this.GetSubjectKeyIdentifier(x509Certificate);
|
||||
if (authorityKeyIdentifier == subjectKeyIdentifier)
|
||||
{
|
||||
return x509Certificate;
|
||||
}
|
||||
}
|
||||
return x509Certificate2Collection[0];
|
||||
}
|
||||
|
||||
// Token: 0x06001815 RID: 6165 RVA: 0x00051684 File Offset: 0x0004F884
|
||||
private X509Certificate2 FindParent(X509Certificate2 certificate)
|
||||
{
|
||||
X509Certificate2Collection x509Certificate2Collection = this.CertificateCollection.Find(X509FindType.FindBySubjectDistinguishedName, certificate.Issuer, false);
|
||||
string authorityKeyIdentifier = this.GetAuthorityKeyIdentifier(certificate);
|
||||
if (authorityKeyIdentifier != null && authorityKeyIdentifier.Length > 0)
|
||||
{
|
||||
x509Certificate2Collection.AddRange(this.CertificateCollection.Find(X509FindType.FindBySubjectKeyIdentifier, authorityKeyIdentifier, false));
|
||||
}
|
||||
X509Certificate2 x509Certificate = this.SelectBestFromCollection(certificate, x509Certificate2Collection);
|
||||
return (!certificate.Equals(x509Certificate)) ? x509Certificate : null;
|
||||
}
|
||||
|
||||
// Token: 0x06001816 RID: 6166 RVA: 0x000516F0 File Offset: 0x0004F8F0
|
||||
private bool IsChainComplete(X509Certificate2 certificate)
|
||||
{
|
||||
if (!this.IsSelfIssued(certificate))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (certificate.Version < 3)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
string subjectKeyIdentifier = this.GetSubjectKeyIdentifier(certificate);
|
||||
if (string.IsNullOrEmpty(subjectKeyIdentifier))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
string authorityKeyIdentifier = this.GetAuthorityKeyIdentifier(certificate);
|
||||
return string.IsNullOrEmpty(authorityKeyIdentifier) || authorityKeyIdentifier == subjectKeyIdentifier;
|
||||
}
|
||||
|
||||
// Token: 0x06001817 RID: 6167 RVA: 0x0005174C File Offset: 0x0004F94C
|
||||
private bool IsSelfIssued(X509Certificate2 certificate)
|
||||
{
|
||||
return certificate.Issuer == certificate.Subject;
|
||||
}
|
||||
|
||||
// Token: 0x06001818 RID: 6168 RVA: 0x00051760 File Offset: 0x0004F960
|
||||
private void ValidateChain(X509ChainStatusFlags flag)
|
||||
{
|
||||
int num = this.elements.Count - 1;
|
||||
X509Certificate2 certificate = this.elements[num].Certificate;
|
||||
if ((flag & X509ChainStatusFlags.PartialChain) == X509ChainStatusFlags.NoError)
|
||||
{
|
||||
this.Process(num);
|
||||
if (num == 0)
|
||||
{
|
||||
this.elements[0].UncompressFlags();
|
||||
return;
|
||||
}
|
||||
num--;
|
||||
}
|
||||
this.working_public_key = certificate.PublicKey.Key;
|
||||
this.working_issuer_name = certificate.IssuerName;
|
||||
this.max_path_length = num;
|
||||
for (int i = num; i > 0; i--)
|
||||
{
|
||||
this.Process(i);
|
||||
this.PrepareForNextCertificate(i);
|
||||
}
|
||||
this.Process(0);
|
||||
this.CheckRevocationOnChain(flag);
|
||||
this.WrapUp();
|
||||
}
|
||||
|
||||
// Token: 0x06001819 RID: 6169 RVA: 0x00051814 File Offset: 0x0004FA14
|
||||
private void Process(int n)
|
||||
{
|
||||
X509ChainElement x509ChainElement = this.elements[n];
|
||||
X509Certificate2 certificate = x509ChainElement.Certificate;
|
||||
if (n != this.elements.Count - 1 && certificate.MonoCertificate.KeyAlgorithm == "1.2.840.10040.4.1" && certificate.MonoCertificate.KeyAlgorithmParameters == null)
|
||||
{
|
||||
X509Certificate2 certificate2 = this.elements[n + 1].Certificate;
|
||||
certificate.MonoCertificate.KeyAlgorithmParameters = certificate2.MonoCertificate.KeyAlgorithmParameters;
|
||||
}
|
||||
bool flag = this.working_public_key == null;
|
||||
if (!this.IsSignedWith(certificate, (!flag) ? this.working_public_key : certificate.PublicKey.Key) && (flag || n != this.elements.Count - 1 || this.IsSelfIssued(certificate)))
|
||||
{
|
||||
x509ChainElement.StatusFlags |= X509ChainStatusFlags.NotSignatureValid;
|
||||
}
|
||||
if (this.ChainPolicy.VerificationTime < certificate.NotBefore || this.ChainPolicy.VerificationTime > certificate.NotAfter)
|
||||
{
|
||||
x509ChainElement.StatusFlags |= X509ChainStatusFlags.NotTimeValid;
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!X500DistinguishedName.AreEqual(certificate.IssuerName, this.working_issuer_name))
|
||||
{
|
||||
x509ChainElement.StatusFlags |= X509ChainStatusFlags.InvalidNameConstraints;
|
||||
}
|
||||
if (this.IsSelfIssued(certificate) || n != 0)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600181A RID: 6170 RVA: 0x00051988 File Offset: 0x0004FB88
|
||||
private void PrepareForNextCertificate(int n)
|
||||
{
|
||||
X509ChainElement x509ChainElement = this.elements[n];
|
||||
X509Certificate2 certificate = x509ChainElement.Certificate;
|
||||
this.working_issuer_name = certificate.SubjectName;
|
||||
this.working_public_key = certificate.PublicKey.Key;
|
||||
X509BasicConstraintsExtension x509BasicConstraintsExtension = (X509BasicConstraintsExtension)certificate.Extensions["2.5.29.19"];
|
||||
if (x509BasicConstraintsExtension != null)
|
||||
{
|
||||
if (!x509BasicConstraintsExtension.CertificateAuthority)
|
||||
{
|
||||
x509ChainElement.StatusFlags |= X509ChainStatusFlags.InvalidBasicConstraints;
|
||||
}
|
||||
}
|
||||
else if (certificate.Version >= 3)
|
||||
{
|
||||
x509ChainElement.StatusFlags |= X509ChainStatusFlags.InvalidBasicConstraints;
|
||||
}
|
||||
if (!this.IsSelfIssued(certificate))
|
||||
{
|
||||
if (this.max_path_length > 0)
|
||||
{
|
||||
this.max_path_length--;
|
||||
}
|
||||
else if (this.bce_restriction != null)
|
||||
{
|
||||
this.bce_restriction.StatusFlags |= X509ChainStatusFlags.InvalidBasicConstraints;
|
||||
}
|
||||
}
|
||||
if (x509BasicConstraintsExtension != null && x509BasicConstraintsExtension.HasPathLengthConstraint && x509BasicConstraintsExtension.PathLengthConstraint < this.max_path_length)
|
||||
{
|
||||
this.max_path_length = x509BasicConstraintsExtension.PathLengthConstraint;
|
||||
this.bce_restriction = x509ChainElement;
|
||||
}
|
||||
X509KeyUsageExtension x509KeyUsageExtension = (X509KeyUsageExtension)certificate.Extensions["2.5.29.15"];
|
||||
if (x509KeyUsageExtension != null)
|
||||
{
|
||||
X509KeyUsageFlags x509KeyUsageFlags = X509KeyUsageFlags.KeyCertSign;
|
||||
if ((x509KeyUsageExtension.KeyUsages & x509KeyUsageFlags) != x509KeyUsageFlags)
|
||||
{
|
||||
x509ChainElement.StatusFlags |= X509ChainStatusFlags.NotValidForUsage;
|
||||
}
|
||||
}
|
||||
this.ProcessCertificateExtensions(x509ChainElement);
|
||||
}
|
||||
|
||||
// Token: 0x0600181B RID: 6171 RVA: 0x00051AEC File Offset: 0x0004FCEC
|
||||
private void WrapUp()
|
||||
{
|
||||
X509ChainElement x509ChainElement = this.elements[0];
|
||||
X509Certificate2 certificate = x509ChainElement.Certificate;
|
||||
if (this.IsSelfIssued(certificate))
|
||||
{
|
||||
}
|
||||
this.ProcessCertificateExtensions(x509ChainElement);
|
||||
for (int i = this.elements.Count - 1; i >= 0; i--)
|
||||
{
|
||||
this.elements[i].UncompressFlags();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600181C RID: 6172 RVA: 0x00051B50 File Offset: 0x0004FD50
|
||||
private void ProcessCertificateExtensions(X509ChainElement element)
|
||||
{
|
||||
foreach (X509Extension x509Extension in element.Certificate.Extensions)
|
||||
{
|
||||
if (x509Extension.Critical)
|
||||
{
|
||||
string value = x509Extension.Oid.Value;
|
||||
if (value != null)
|
||||
{
|
||||
if (X509Chain.<>f__switch$mapB == null)
|
||||
{
|
||||
X509Chain.<>f__switch$mapB = new Dictionary<string, int>(2)
|
||||
{
|
||||
{ "2.5.29.15", 0 },
|
||||
{ "2.5.29.19", 0 }
|
||||
};
|
||||
}
|
||||
int num;
|
||||
if (X509Chain.<>f__switch$mapB.TryGetValue(value, out num))
|
||||
{
|
||||
if (num == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
element.StatusFlags |= X509ChainStatusFlags.InvalidExtension;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600181D RID: 6173 RVA: 0x00051C0C File Offset: 0x0004FE0C
|
||||
private bool IsSignedWith(X509Certificate2 signed, AsymmetricAlgorithm pubkey)
|
||||
{
|
||||
if (pubkey == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
X509Certificate monoCertificate = signed.MonoCertificate;
|
||||
return monoCertificate.VerifySignature(pubkey);
|
||||
}
|
||||
|
||||
// Token: 0x0600181E RID: 6174 RVA: 0x00051C30 File Offset: 0x0004FE30
|
||||
private string GetSubjectKeyIdentifier(X509Certificate2 certificate)
|
||||
{
|
||||
X509SubjectKeyIdentifierExtension x509SubjectKeyIdentifierExtension = (X509SubjectKeyIdentifierExtension)certificate.Extensions["2.5.29.14"];
|
||||
return (x509SubjectKeyIdentifierExtension != null) ? x509SubjectKeyIdentifierExtension.SubjectKeyIdentifier : string.Empty;
|
||||
}
|
||||
|
||||
// Token: 0x0600181F RID: 6175 RVA: 0x00051C6C File Offset: 0x0004FE6C
|
||||
private string GetAuthorityKeyIdentifier(X509Certificate2 certificate)
|
||||
{
|
||||
return this.GetAuthorityKeyIdentifier(certificate.MonoCertificate.Extensions["2.5.29.35"]);
|
||||
}
|
||||
|
||||
// Token: 0x06001820 RID: 6176 RVA: 0x00051C94 File Offset: 0x0004FE94
|
||||
private string GetAuthorityKeyIdentifier(X509Crl crl)
|
||||
{
|
||||
return this.GetAuthorityKeyIdentifier(crl.Extensions["2.5.29.35"]);
|
||||
}
|
||||
|
||||
// Token: 0x06001821 RID: 6177 RVA: 0x00051CAC File Offset: 0x0004FEAC
|
||||
private string GetAuthorityKeyIdentifier(X509Extension ext)
|
||||
{
|
||||
if (ext == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
AuthorityKeyIdentifierExtension authorityKeyIdentifierExtension = new AuthorityKeyIdentifierExtension(ext);
|
||||
byte[] identifier = authorityKeyIdentifierExtension.Identifier;
|
||||
if (identifier == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
foreach (byte b in identifier)
|
||||
{
|
||||
stringBuilder.Append(b.ToString("X02"));
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
// Token: 0x06001822 RID: 6178 RVA: 0x00051D20 File Offset: 0x0004FF20
|
||||
private void CheckRevocationOnChain(X509ChainStatusFlags flag)
|
||||
{
|
||||
bool flag2 = (flag & X509ChainStatusFlags.PartialChain) != X509ChainStatusFlags.NoError;
|
||||
bool flag3;
|
||||
switch (this.ChainPolicy.RevocationMode)
|
||||
{
|
||||
case X509RevocationMode.NoCheck:
|
||||
return;
|
||||
case X509RevocationMode.Online:
|
||||
flag3 = true;
|
||||
break;
|
||||
case X509RevocationMode.Offline:
|
||||
flag3 = false;
|
||||
break;
|
||||
default:
|
||||
throw new InvalidOperationException(global::Locale.GetText("Invalid revocation mode."));
|
||||
}
|
||||
bool flag4 = flag2;
|
||||
for (int i = this.elements.Count - 1; i >= 0; i--)
|
||||
{
|
||||
bool flag5 = true;
|
||||
switch (this.ChainPolicy.RevocationFlag)
|
||||
{
|
||||
case X509RevocationFlag.EndCertificateOnly:
|
||||
flag5 = i == 0;
|
||||
break;
|
||||
case X509RevocationFlag.EntireChain:
|
||||
flag5 = true;
|
||||
break;
|
||||
case X509RevocationFlag.ExcludeRoot:
|
||||
flag5 = i != this.elements.Count - 1;
|
||||
break;
|
||||
}
|
||||
X509ChainElement x509ChainElement = this.elements[i];
|
||||
if (!flag4)
|
||||
{
|
||||
flag4 |= (x509ChainElement.StatusFlags & X509ChainStatusFlags.NotSignatureValid) != X509ChainStatusFlags.NoError;
|
||||
}
|
||||
if (flag4)
|
||||
{
|
||||
x509ChainElement.StatusFlags |= X509ChainStatusFlags.RevocationStatusUnknown;
|
||||
x509ChainElement.StatusFlags |= X509ChainStatusFlags.OfflineRevocation;
|
||||
}
|
||||
else if (flag5 && !flag2 && !this.IsSelfIssued(x509ChainElement.Certificate))
|
||||
{
|
||||
x509ChainElement.StatusFlags |= this.CheckRevocation(x509ChainElement.Certificate, i + 1, flag3);
|
||||
flag4 |= (x509ChainElement.StatusFlags & X509ChainStatusFlags.Revoked) != X509ChainStatusFlags.NoError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001823 RID: 6179 RVA: 0x00051E98 File Offset: 0x00050098
|
||||
private X509ChainStatusFlags CheckRevocation(X509Certificate2 certificate, int ca, bool online)
|
||||
{
|
||||
X509ChainStatusFlags x509ChainStatusFlags = X509ChainStatusFlags.RevocationStatusUnknown;
|
||||
X509ChainElement x509ChainElement = this.elements[ca];
|
||||
X509Certificate2 x509Certificate = x509ChainElement.Certificate;
|
||||
while (this.IsSelfIssued(x509Certificate) && ca < this.elements.Count - 1)
|
||||
{
|
||||
x509ChainStatusFlags = this.CheckRevocation(certificate, x509Certificate, online);
|
||||
if (x509ChainStatusFlags != X509ChainStatusFlags.RevocationStatusUnknown)
|
||||
{
|
||||
break;
|
||||
}
|
||||
ca++;
|
||||
x509ChainElement = this.elements[ca];
|
||||
x509Certificate = x509ChainElement.Certificate;
|
||||
}
|
||||
if (x509ChainStatusFlags == X509ChainStatusFlags.RevocationStatusUnknown)
|
||||
{
|
||||
x509ChainStatusFlags = this.CheckRevocation(certificate, x509Certificate, online);
|
||||
}
|
||||
return x509ChainStatusFlags;
|
||||
}
|
||||
|
||||
// Token: 0x06001824 RID: 6180 RVA: 0x00051F24 File Offset: 0x00050124
|
||||
private X509ChainStatusFlags CheckRevocation(X509Certificate2 certificate, X509Certificate2 ca_cert, bool online)
|
||||
{
|
||||
X509KeyUsageExtension x509KeyUsageExtension = (X509KeyUsageExtension)ca_cert.Extensions["2.5.29.15"];
|
||||
if (x509KeyUsageExtension != null)
|
||||
{
|
||||
X509KeyUsageFlags x509KeyUsageFlags = X509KeyUsageFlags.CrlSign;
|
||||
if ((x509KeyUsageExtension.KeyUsages & x509KeyUsageFlags) != x509KeyUsageFlags)
|
||||
{
|
||||
return X509ChainStatusFlags.RevocationStatusUnknown;
|
||||
}
|
||||
}
|
||||
X509Crl x509Crl = this.FindCrl(ca_cert);
|
||||
if (x509Crl != null || online)
|
||||
{
|
||||
}
|
||||
if (x509Crl == null)
|
||||
{
|
||||
return X509ChainStatusFlags.RevocationStatusUnknown;
|
||||
}
|
||||
if (!x509Crl.VerifySignature(ca_cert.PublicKey.Key))
|
||||
{
|
||||
return X509ChainStatusFlags.RevocationStatusUnknown;
|
||||
}
|
||||
X509Crl.X509CrlEntry crlEntry = x509Crl.GetCrlEntry(certificate.MonoCertificate);
|
||||
if (crlEntry != null)
|
||||
{
|
||||
if (!this.ProcessCrlEntryExtensions(crlEntry))
|
||||
{
|
||||
return X509ChainStatusFlags.Revoked;
|
||||
}
|
||||
if (crlEntry.RevocationDate <= this.ChainPolicy.VerificationTime)
|
||||
{
|
||||
return X509ChainStatusFlags.Revoked;
|
||||
}
|
||||
}
|
||||
if (x509Crl.NextUpdate < this.ChainPolicy.VerificationTime)
|
||||
{
|
||||
return X509ChainStatusFlags.RevocationStatusUnknown | X509ChainStatusFlags.OfflineRevocation;
|
||||
}
|
||||
if (!this.ProcessCrlExtensions(x509Crl))
|
||||
{
|
||||
return X509ChainStatusFlags.RevocationStatusUnknown;
|
||||
}
|
||||
return X509ChainStatusFlags.NoError;
|
||||
}
|
||||
|
||||
// Token: 0x06001825 RID: 6181 RVA: 0x0005200C File Offset: 0x0005020C
|
||||
private X509Crl FindCrl(X509Certificate2 caCertificate)
|
||||
{
|
||||
string text = caCertificate.SubjectName.Decode(X500DistinguishedNameFlags.None);
|
||||
string subjectKeyIdentifier = this.GetSubjectKeyIdentifier(caCertificate);
|
||||
foreach (object obj in this.CertificateAuthorities.Store.Crls)
|
||||
{
|
||||
X509Crl x509Crl = (X509Crl)obj;
|
||||
if (x509Crl.IssuerName == text && (subjectKeyIdentifier.Length == 0 || subjectKeyIdentifier == this.GetAuthorityKeyIdentifier(x509Crl)))
|
||||
{
|
||||
return x509Crl;
|
||||
}
|
||||
}
|
||||
foreach (object obj2 in this.Roots.Store.Crls)
|
||||
{
|
||||
X509Crl x509Crl2 = (X509Crl)obj2;
|
||||
if (x509Crl2.IssuerName == text && (subjectKeyIdentifier.Length == 0 || subjectKeyIdentifier == this.GetAuthorityKeyIdentifier(x509Crl2)))
|
||||
{
|
||||
return x509Crl2;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Token: 0x06001826 RID: 6182 RVA: 0x00052174 File Offset: 0x00050374
|
||||
private bool ProcessCrlExtensions(X509Crl crl)
|
||||
{
|
||||
foreach (object obj in crl.Extensions)
|
||||
{
|
||||
X509Extension x509Extension = (X509Extension)obj;
|
||||
if (x509Extension.Critical)
|
||||
{
|
||||
string oid = x509Extension.Oid;
|
||||
if (oid != null)
|
||||
{
|
||||
if (X509Chain.<>f__switch$mapC == null)
|
||||
{
|
||||
X509Chain.<>f__switch$mapC = new Dictionary<string, int>(2)
|
||||
{
|
||||
{ "2.5.29.20", 0 },
|
||||
{ "2.5.29.35", 0 }
|
||||
};
|
||||
}
|
||||
int num;
|
||||
if (X509Chain.<>f__switch$mapC.TryGetValue(oid, out num))
|
||||
{
|
||||
if (num == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x06001827 RID: 6183 RVA: 0x00052258 File Offset: 0x00050458
|
||||
private bool ProcessCrlEntryExtensions(X509Crl.X509CrlEntry entry)
|
||||
{
|
||||
foreach (object obj in entry.Extensions)
|
||||
{
|
||||
X509Extension x509Extension = (X509Extension)obj;
|
||||
if (x509Extension.Critical)
|
||||
{
|
||||
string oid = x509Extension.Oid;
|
||||
if (oid != null)
|
||||
{
|
||||
if (X509Chain.<>f__switch$mapD == null)
|
||||
{
|
||||
X509Chain.<>f__switch$mapD = new Dictionary<string, int>(1) { { "2.5.29.21", 0 } };
|
||||
}
|
||||
int num;
|
||||
if (X509Chain.<>f__switch$mapD.TryGetValue(oid, out num))
|
||||
{
|
||||
if (num == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x04001307 RID: 4871
|
||||
private StoreLocation location;
|
||||
|
||||
// Token: 0x04001308 RID: 4872
|
||||
private X509ChainElementCollection elements;
|
||||
|
||||
// Token: 0x04001309 RID: 4873
|
||||
private X509ChainPolicy policy;
|
||||
|
||||
// Token: 0x0400130A RID: 4874
|
||||
private X509ChainStatus[] status;
|
||||
|
||||
// Token: 0x0400130B RID: 4875
|
||||
private static X509ChainStatus[] Empty = new X509ChainStatus[0];
|
||||
|
||||
// Token: 0x0400130C RID: 4876
|
||||
private int max_path_length;
|
||||
|
||||
// Token: 0x0400130D RID: 4877
|
||||
private X500DistinguishedName working_issuer_name;
|
||||
|
||||
// Token: 0x0400130E RID: 4878
|
||||
private AsymmetricAlgorithm working_public_key;
|
||||
|
||||
// Token: 0x0400130F RID: 4879
|
||||
private X509ChainElement bce_restriction;
|
||||
|
||||
// Token: 0x04001310 RID: 4880
|
||||
private X509Store roots;
|
||||
|
||||
// Token: 0x04001311 RID: 4881
|
||||
private X509Store cas;
|
||||
|
||||
// Token: 0x04001312 RID: 4882
|
||||
private X509Certificate2Collection collection;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
using System;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Represents an element of an X.509 chain.</summary>
|
||||
// Token: 0x0200028E RID: 654
|
||||
public class X509ChainElement
|
||||
{
|
||||
// Token: 0x06001828 RID: 6184 RVA: 0x00052330 File Offset: 0x00050530
|
||||
internal X509ChainElement(X509Certificate2 certificate)
|
||||
{
|
||||
this.certificate = certificate;
|
||||
this.info = string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>Gets the X.509 certificate at a particular chain element.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> object.</returns>
|
||||
// Token: 0x17000794 RID: 1940
|
||||
// (get) Token: 0x06001829 RID: 6185 RVA: 0x0005234C File Offset: 0x0005054C
|
||||
public X509Certificate2 Certificate
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.certificate;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the error status of the current X.509 certificate in a chain.</summary>
|
||||
/// <returns>An array of <see cref="T:System.Security.Cryptography.X509Certificates.X509ChainStatus" /> objects.</returns>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x17000795 RID: 1941
|
||||
// (get) Token: 0x0600182A RID: 6186 RVA: 0x00052354 File Offset: 0x00050554
|
||||
public X509ChainStatus[] ChainElementStatus
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.status;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets additional error information from an unmanaged certificate chain structure.</summary>
|
||||
/// <returns>A string representing the pwszExtendedErrorInfo member of the unmanaged CERT_CHAIN_ELEMENT structure in the Crypto API.</returns>
|
||||
// Token: 0x17000796 RID: 1942
|
||||
// (get) Token: 0x0600182B RID: 6187 RVA: 0x0005235C File Offset: 0x0005055C
|
||||
public string Information
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.info;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000797 RID: 1943
|
||||
// (get) Token: 0x0600182C RID: 6188 RVA: 0x00052364 File Offset: 0x00050564
|
||||
// (set) Token: 0x0600182D RID: 6189 RVA: 0x0005236C File Offset: 0x0005056C
|
||||
internal X509ChainStatusFlags StatusFlags
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.compressed_status_flags;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.compressed_status_flags = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600182E RID: 6190 RVA: 0x00052378 File Offset: 0x00050578
|
||||
private int Count(X509ChainStatusFlags flags)
|
||||
{
|
||||
int num = 0;
|
||||
int num2 = 0;
|
||||
int num3 = 1;
|
||||
while (num2++ < 32)
|
||||
{
|
||||
if ((flags & (X509ChainStatusFlags)num3) == (X509ChainStatusFlags)num3)
|
||||
{
|
||||
num++;
|
||||
}
|
||||
num3 <<= 1;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x0600182F RID: 6191 RVA: 0x000523B0 File Offset: 0x000505B0
|
||||
private void Set(X509ChainStatus[] status, ref int position, X509ChainStatusFlags flags, X509ChainStatusFlags mask)
|
||||
{
|
||||
if ((flags & mask) != X509ChainStatusFlags.NoError)
|
||||
{
|
||||
status[position].Status = mask;
|
||||
status[position].StatusInformation = X509ChainStatus.GetInformation(mask);
|
||||
position++;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001830 RID: 6192 RVA: 0x000523F0 File Offset: 0x000505F0
|
||||
internal void UncompressFlags()
|
||||
{
|
||||
if (this.compressed_status_flags == X509ChainStatusFlags.NoError)
|
||||
{
|
||||
this.status = new X509ChainStatus[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
int num = this.Count(this.compressed_status_flags);
|
||||
this.status = new X509ChainStatus[num];
|
||||
int num2 = 0;
|
||||
this.Set(this.status, ref num2, this.compressed_status_flags, X509ChainStatusFlags.UntrustedRoot);
|
||||
this.Set(this.status, ref num2, this.compressed_status_flags, X509ChainStatusFlags.NotTimeValid);
|
||||
this.Set(this.status, ref num2, this.compressed_status_flags, X509ChainStatusFlags.NotTimeNested);
|
||||
this.Set(this.status, ref num2, this.compressed_status_flags, X509ChainStatusFlags.Revoked);
|
||||
this.Set(this.status, ref num2, this.compressed_status_flags, X509ChainStatusFlags.NotSignatureValid);
|
||||
this.Set(this.status, ref num2, this.compressed_status_flags, X509ChainStatusFlags.NotValidForUsage);
|
||||
this.Set(this.status, ref num2, this.compressed_status_flags, X509ChainStatusFlags.RevocationStatusUnknown);
|
||||
this.Set(this.status, ref num2, this.compressed_status_flags, X509ChainStatusFlags.Cyclic);
|
||||
this.Set(this.status, ref num2, this.compressed_status_flags, X509ChainStatusFlags.InvalidExtension);
|
||||
this.Set(this.status, ref num2, this.compressed_status_flags, X509ChainStatusFlags.InvalidPolicyConstraints);
|
||||
this.Set(this.status, ref num2, this.compressed_status_flags, X509ChainStatusFlags.InvalidBasicConstraints);
|
||||
this.Set(this.status, ref num2, this.compressed_status_flags, X509ChainStatusFlags.InvalidNameConstraints);
|
||||
this.Set(this.status, ref num2, this.compressed_status_flags, X509ChainStatusFlags.HasNotSupportedNameConstraint);
|
||||
this.Set(this.status, ref num2, this.compressed_status_flags, X509ChainStatusFlags.HasNotDefinedNameConstraint);
|
||||
this.Set(this.status, ref num2, this.compressed_status_flags, X509ChainStatusFlags.HasNotPermittedNameConstraint);
|
||||
this.Set(this.status, ref num2, this.compressed_status_flags, X509ChainStatusFlags.HasExcludedNameConstraint);
|
||||
this.Set(this.status, ref num2, this.compressed_status_flags, X509ChainStatusFlags.PartialChain);
|
||||
this.Set(this.status, ref num2, this.compressed_status_flags, X509ChainStatusFlags.CtlNotTimeValid);
|
||||
this.Set(this.status, ref num2, this.compressed_status_flags, X509ChainStatusFlags.CtlNotSignatureValid);
|
||||
this.Set(this.status, ref num2, this.compressed_status_flags, X509ChainStatusFlags.CtlNotValidForUsage);
|
||||
this.Set(this.status, ref num2, this.compressed_status_flags, X509ChainStatusFlags.OfflineRevocation);
|
||||
this.Set(this.status, ref num2, this.compressed_status_flags, X509ChainStatusFlags.NoIssuanceChainPolicy);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04001316 RID: 4886
|
||||
private X509Certificate2 certificate;
|
||||
|
||||
// Token: 0x04001317 RID: 4887
|
||||
private X509ChainStatus[] status;
|
||||
|
||||
// Token: 0x04001318 RID: 4888
|
||||
private string info;
|
||||
|
||||
// Token: 0x04001319 RID: 4889
|
||||
private X509ChainStatusFlags compressed_status_flags;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Represents a collection of <see cref="T:System.Security.Cryptography.X509Certificates.X509ChainElement" /> objects. This class cannot be inherited.</summary>
|
||||
// Token: 0x0200028F RID: 655
|
||||
public sealed class X509ChainElementCollection : ICollection, IEnumerable
|
||||
{
|
||||
// Token: 0x06001831 RID: 6193 RVA: 0x00052644 File Offset: 0x00050844
|
||||
internal X509ChainElementCollection()
|
||||
{
|
||||
this._list = new ArrayList();
|
||||
}
|
||||
|
||||
/// <summary>Copies an <see cref="T:System.Security.Cryptography.X509Certificates.X509ChainElementCollection" /> object into an array, starting at the specified index.</summary>
|
||||
/// <param name="array">An array to copy the <see cref="T:System.Security.Cryptography.X509Certificates.X509ChainElementCollection" /> object to.</param>
|
||||
/// <param name="index">The index of <paramref name="array" /> at which to start copying.</param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">The specified <paramref name="index" /> is less than zero, or greater than or equal to the length of the array. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="array" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="index" /> plus the current count is greater than the length of the array. </exception>
|
||||
// Token: 0x06001832 RID: 6194 RVA: 0x00052658 File Offset: 0x00050858
|
||||
void ICollection.CopyTo(Array array, int index)
|
||||
{
|
||||
this._list.CopyTo(array, index);
|
||||
}
|
||||
|
||||
/// <summary>Gets an <see cref="T:System.Collections.IEnumerator" /> object that can be used to navigate a collection of chain elements.</summary>
|
||||
/// <returns>An <see cref="T:System.Collections.IEnumerator" /> object.</returns>
|
||||
// Token: 0x06001833 RID: 6195 RVA: 0x00052668 File Offset: 0x00050868
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return new X509ChainElementEnumerator(this._list);
|
||||
}
|
||||
|
||||
/// <summary>Gets the number of elements in the collection.</summary>
|
||||
/// <returns>An integer representing the number of elements in the collection.</returns>
|
||||
// Token: 0x17000798 RID: 1944
|
||||
// (get) Token: 0x06001834 RID: 6196 RVA: 0x00052678 File Offset: 0x00050878
|
||||
public int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._list.Count;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a value indicating whether the collection of chain elements is synchronized.</summary>
|
||||
/// <returns>Always returns false.</returns>
|
||||
// Token: 0x17000799 RID: 1945
|
||||
// (get) Token: 0x06001835 RID: 6197 RVA: 0x00052688 File Offset: 0x00050888
|
||||
public bool IsSynchronized
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._list.IsSynchronized;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the <see cref="T:System.Security.Cryptography.X509Certificates.X509ChainElement" /> object at the specified index.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.X509Certificates.X509ChainElement" /> object.</returns>
|
||||
/// <param name="index">An integer value. </param>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="index" /> is less than zero. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> is greater than or equal to the length of the collection. </exception>
|
||||
// Token: 0x1700079A RID: 1946
|
||||
public X509ChainElement this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return (X509ChainElement)this._list[index];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets an object that can be used to synchronize access to an <see cref="T:System.Security.Cryptography.X509Certificates.X509ChainElementCollection" /> object.</summary>
|
||||
/// <returns>A pointer reference to the current object.</returns>
|
||||
// Token: 0x1700079B RID: 1947
|
||||
// (get) Token: 0x06001837 RID: 6199 RVA: 0x000526AC File Offset: 0x000508AC
|
||||
public object SyncRoot
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._list.SyncRoot;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Copies an <see cref="T:System.Security.Cryptography.X509Certificates.X509ChainElementCollection" /> object into an array, starting at the specified index.</summary>
|
||||
/// <param name="array">An array of <see cref="T:System.Security.Cryptography.X509Certificates.X509ChainElement" /> objects. </param>
|
||||
/// <param name="index">An integer representing the index value. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">The specified <paramref name="index" /> is less than zero, or greater than or equal to the length of the array. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="array" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="index" /> plus the current count is greater than the length of the array. </exception>
|
||||
// Token: 0x06001838 RID: 6200 RVA: 0x000526BC File Offset: 0x000508BC
|
||||
public void CopyTo(X509ChainElement[] array, int index)
|
||||
{
|
||||
this._list.CopyTo(array, index);
|
||||
}
|
||||
|
||||
/// <summary>Gets an <see cref="T:System.Security.Cryptography.X509Certificates.X509ChainElementEnumerator" /> object that can be used to navigate through a collection of chain elements.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.X509Certificates.X509ChainElementEnumerator" /> object.</returns>
|
||||
// Token: 0x06001839 RID: 6201 RVA: 0x000526CC File Offset: 0x000508CC
|
||||
public X509ChainElementEnumerator GetEnumerator()
|
||||
{
|
||||
return new X509ChainElementEnumerator(this._list);
|
||||
}
|
||||
|
||||
// Token: 0x0600183A RID: 6202 RVA: 0x000526DC File Offset: 0x000508DC
|
||||
internal void Add(X509Certificate2 certificate)
|
||||
{
|
||||
this._list.Add(new X509ChainElement(certificate));
|
||||
}
|
||||
|
||||
// Token: 0x0600183B RID: 6203 RVA: 0x000526F0 File Offset: 0x000508F0
|
||||
internal void Clear()
|
||||
{
|
||||
this._list.Clear();
|
||||
}
|
||||
|
||||
// Token: 0x0600183C RID: 6204 RVA: 0x00052700 File Offset: 0x00050900
|
||||
internal bool Contains(X509Certificate2 certificate)
|
||||
{
|
||||
for (int i = 0; i < this._list.Count; i++)
|
||||
{
|
||||
if (certificate.Equals((this._list[i] as X509ChainElement).Certificate))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Token: 0x0400131A RID: 4890
|
||||
private ArrayList _list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Supports a simple iteration over an <see cref="T:System.Security.Cryptography.X509Certificates.X509ChainElementCollection" />. This class cannot be inherited.</summary>
|
||||
// Token: 0x02000290 RID: 656
|
||||
public sealed class X509ChainElementEnumerator : IEnumerator
|
||||
{
|
||||
// Token: 0x0600183D RID: 6205 RVA: 0x00052750 File Offset: 0x00050950
|
||||
internal X509ChainElementEnumerator(IEnumerable enumerable)
|
||||
{
|
||||
this.enumerator = enumerable.GetEnumerator();
|
||||
}
|
||||
|
||||
/// <summary>Gets the current element in the <see cref="T:System.Security.Cryptography.X509Certificates.X509ChainElementCollection" />.</summary>
|
||||
/// <returns>The current element in the <see cref="T:System.Security.Cryptography.X509Certificates.X509ChainElementCollection" />.</returns>
|
||||
/// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element. </exception>
|
||||
// Token: 0x1700079C RID: 1948
|
||||
// (get) Token: 0x0600183E RID: 6206 RVA: 0x00052764 File Offset: 0x00050964
|
||||
object IEnumerator.Current
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.enumerator.Current;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the current element in the <see cref="T:System.Security.Cryptography.X509Certificates.X509ChainElementCollection" />.</summary>
|
||||
/// <returns>The current element in the <see cref="T:System.Security.Cryptography.X509Certificates.X509ChainElementCollection" />.</returns>
|
||||
/// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element. </exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x1700079D RID: 1949
|
||||
// (get) Token: 0x0600183F RID: 6207 RVA: 0x00052774 File Offset: 0x00050974
|
||||
public X509ChainElement Current
|
||||
{
|
||||
get
|
||||
{
|
||||
return (X509ChainElement)this.enumerator.Current;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Advances the enumerator to the next element in the <see cref="T:System.Security.Cryptography.X509Certificates.X509ChainElementCollection" />.</summary>
|
||||
/// <returns>true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.</returns>
|
||||
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception>
|
||||
// Token: 0x06001840 RID: 6208 RVA: 0x00052788 File Offset: 0x00050988
|
||||
public bool MoveNext()
|
||||
{
|
||||
return this.enumerator.MoveNext();
|
||||
}
|
||||
|
||||
/// <summary>Sets the enumerator to its initial position, which is before the first element in the <see cref="T:System.Security.Cryptography.X509Certificates.X509ChainElementCollection" />.</summary>
|
||||
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception>
|
||||
// Token: 0x06001841 RID: 6209 RVA: 0x00052798 File Offset: 0x00050998
|
||||
public void Reset()
|
||||
{
|
||||
this.enumerator.Reset();
|
||||
}
|
||||
|
||||
// Token: 0x0400131B RID: 4891
|
||||
private IEnumerator enumerator;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
using System;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Represents the chain policy to be applied when building an X509 certificate chain. This class cannot be inherited.</summary>
|
||||
// Token: 0x02000291 RID: 657
|
||||
public sealed class X509ChainPolicy
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509ChainPolicy" /> class. </summary>
|
||||
// Token: 0x06001842 RID: 6210 RVA: 0x000527A8 File Offset: 0x000509A8
|
||||
public X509ChainPolicy()
|
||||
{
|
||||
this.Reset();
|
||||
}
|
||||
|
||||
/// <summary>Gets a collection of object identifiers (OIDs) specifying which application policies or enhanced key usages (EKUs) the certificate supports.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.OidCollection" /> object.</returns>
|
||||
// Token: 0x1700079E RID: 1950
|
||||
// (get) Token: 0x06001843 RID: 6211 RVA: 0x000527B8 File Offset: 0x000509B8
|
||||
public OidCollection ApplicationPolicy
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.apps;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a collection of object identifiers (OIDs) specifying which certificate policies the certificate supports.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.OidCollection" /> object.</returns>
|
||||
// Token: 0x1700079F RID: 1951
|
||||
// (get) Token: 0x06001844 RID: 6212 RVA: 0x000527C0 File Offset: 0x000509C0
|
||||
public OidCollection CertificatePolicy
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.cert;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Represents an additional collection of certificates that can be searched by the chaining engine when validating a certificate chain.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> object.</returns>
|
||||
// Token: 0x170007A0 RID: 1952
|
||||
// (get) Token: 0x06001845 RID: 6213 RVA: 0x000527C8 File Offset: 0x000509C8
|
||||
public X509Certificate2Collection ExtraStore
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.store;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets values for X509 revocation flags.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.X509Certificates.X509RevocationFlag" /> object.</returns>
|
||||
/// <exception cref="T:System.ArgumentException">The <see cref="T:System.Security.Cryptography.X509Certificates.X509RevocationFlag" /> value supplied is not a valid flag. </exception>
|
||||
// Token: 0x170007A1 RID: 1953
|
||||
// (get) Token: 0x06001846 RID: 6214 RVA: 0x000527D0 File Offset: 0x000509D0
|
||||
// (set) Token: 0x06001847 RID: 6215 RVA: 0x000527D8 File Offset: 0x000509D8
|
||||
public X509RevocationFlag RevocationFlag
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.rflag;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value < X509RevocationFlag.EndCertificateOnly || value > X509RevocationFlag.ExcludeRoot)
|
||||
{
|
||||
throw new ArgumentException("RevocationFlag");
|
||||
}
|
||||
this.rflag = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets values for X509 certificate revocation mode.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.X509Certificates.X509RevocationMode" /> object.</returns>
|
||||
/// <exception cref="T:System.ArgumentException">The <see cref="T:System.Security.Cryptography.X509Certificates.X509RevocationMode" /> value supplied is not a valid flag. </exception>
|
||||
// Token: 0x170007A2 RID: 1954
|
||||
// (get) Token: 0x06001848 RID: 6216 RVA: 0x00052808 File Offset: 0x00050A08
|
||||
// (set) Token: 0x06001849 RID: 6217 RVA: 0x00052810 File Offset: 0x00050A10
|
||||
public X509RevocationMode RevocationMode
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.mode;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value < X509RevocationMode.NoCheck || value > X509RevocationMode.Offline)
|
||||
{
|
||||
throw new ArgumentException("RevocationMode");
|
||||
}
|
||||
this.mode = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the time span that elapsed during online revocation verification or downloading the certificate revocation list (CRL).</summary>
|
||||
/// <returns>A <see cref="T:System.TimeSpan" /> object.</returns>
|
||||
// Token: 0x170007A3 RID: 1955
|
||||
// (get) Token: 0x0600184A RID: 6218 RVA: 0x00052840 File Offset: 0x00050A40
|
||||
// (set) Token: 0x0600184B RID: 6219 RVA: 0x00052848 File Offset: 0x00050A48
|
||||
public TimeSpan UrlRetrievalTimeout
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.timeout;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.timeout = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets verification flags for the certificate.</summary>
|
||||
/// <returns>A value from the <see cref="T:System.Security.Cryptography.X509Certificates.X509VerificationFlags" /> enumeration.</returns>
|
||||
/// <exception cref="T:System.ArgumentException">The <see cref="T:System.Security.Cryptography.X509Certificates.X509VerificationFlags" /> value supplied is not a valid flag. <see cref="F:System.Security.Cryptography.X509Certificates.X509VerificationFlags.NoFlag" /> is the default value. </exception>
|
||||
// Token: 0x170007A4 RID: 1956
|
||||
// (get) Token: 0x0600184C RID: 6220 RVA: 0x00052854 File Offset: 0x00050A54
|
||||
// (set) Token: 0x0600184D RID: 6221 RVA: 0x0005285C File Offset: 0x00050A5C
|
||||
public X509VerificationFlags VerificationFlags
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.vflags;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ((value | X509VerificationFlags.AllFlags) != X509VerificationFlags.AllFlags)
|
||||
{
|
||||
throw new ArgumentException("VerificationFlags");
|
||||
}
|
||||
this.vflags = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The time that the certificate was verified expressed in local time.</summary>
|
||||
/// <returns>A <see cref="T:System.DateTime" /> object.</returns>
|
||||
// Token: 0x170007A5 RID: 1957
|
||||
// (get) Token: 0x0600184E RID: 6222 RVA: 0x00052884 File Offset: 0x00050A84
|
||||
// (set) Token: 0x0600184F RID: 6223 RVA: 0x0005288C File Offset: 0x00050A8C
|
||||
public DateTime VerificationTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.vtime;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.vtime = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Resets the <see cref="T:System.Security.Cryptography.X509Certificates.X509ChainPolicy" /> members to their default values.</summary>
|
||||
// Token: 0x06001850 RID: 6224 RVA: 0x00052898 File Offset: 0x00050A98
|
||||
public void Reset()
|
||||
{
|
||||
this.apps = new OidCollection();
|
||||
this.cert = new OidCollection();
|
||||
this.store = new X509Certificate2Collection();
|
||||
this.rflag = X509RevocationFlag.ExcludeRoot;
|
||||
this.mode = X509RevocationMode.Online;
|
||||
this.timeout = TimeSpan.Zero;
|
||||
this.vflags = X509VerificationFlags.NoFlag;
|
||||
this.vtime = DateTime.Now;
|
||||
}
|
||||
|
||||
// Token: 0x0400131C RID: 4892
|
||||
private OidCollection apps;
|
||||
|
||||
// Token: 0x0400131D RID: 4893
|
||||
private OidCollection cert;
|
||||
|
||||
// Token: 0x0400131E RID: 4894
|
||||
private X509Certificate2Collection store;
|
||||
|
||||
// Token: 0x0400131F RID: 4895
|
||||
private X509RevocationFlag rflag;
|
||||
|
||||
// Token: 0x04001320 RID: 4896
|
||||
private X509RevocationMode mode;
|
||||
|
||||
// Token: 0x04001321 RID: 4897
|
||||
private TimeSpan timeout;
|
||||
|
||||
// Token: 0x04001322 RID: 4898
|
||||
private X509VerificationFlags vflags;
|
||||
|
||||
// Token: 0x04001323 RID: 4899
|
||||
private DateTime vtime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
using System;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Provides a simple structure for storing X509 chain status and error information.</summary>
|
||||
// Token: 0x02000292 RID: 658
|
||||
public struct X509ChainStatus
|
||||
{
|
||||
// Token: 0x06001851 RID: 6225 RVA: 0x000528F4 File Offset: 0x00050AF4
|
||||
internal X509ChainStatus(X509ChainStatusFlags flag)
|
||||
{
|
||||
this.status = flag;
|
||||
this.info = X509ChainStatus.GetInformation(flag);
|
||||
}
|
||||
|
||||
/// <summary>Specifies the status of the X509 chain.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.X509Certificates.X509ChainStatusFlags" /> value.</returns>
|
||||
// Token: 0x170007A6 RID: 1958
|
||||
// (get) Token: 0x06001852 RID: 6226 RVA: 0x0005290C File Offset: 0x00050B0C
|
||||
// (set) Token: 0x06001853 RID: 6227 RVA: 0x00052914 File Offset: 0x00050B14
|
||||
public X509ChainStatusFlags Status
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.status;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.status = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Specifies a description of the <see cref="P:System.Security.Cryptography.X509Certificates.X509Chain.ChainStatus" /> value.</summary>
|
||||
/// <returns>A localizable string.</returns>
|
||||
// Token: 0x170007A7 RID: 1959
|
||||
// (get) Token: 0x06001854 RID: 6228 RVA: 0x00052920 File Offset: 0x00050B20
|
||||
// (set) Token: 0x06001855 RID: 6229 RVA: 0x00052928 File Offset: 0x00050B28
|
||||
public string StatusInformation
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.info;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.info = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001856 RID: 6230 RVA: 0x00052934 File Offset: 0x00050B34
|
||||
internal static string GetInformation(X509ChainStatusFlags flags)
|
||||
{
|
||||
switch (flags)
|
||||
{
|
||||
case X509ChainStatusFlags.NoError:
|
||||
goto IL_FF;
|
||||
case X509ChainStatusFlags.NotTimeValid:
|
||||
case X509ChainStatusFlags.NotTimeNested:
|
||||
case X509ChainStatusFlags.Revoked:
|
||||
case X509ChainStatusFlags.NotSignatureValid:
|
||||
break;
|
||||
default:
|
||||
if (flags != X509ChainStatusFlags.NotValidForUsage && flags != X509ChainStatusFlags.UntrustedRoot && flags != X509ChainStatusFlags.RevocationStatusUnknown && flags != X509ChainStatusFlags.Cyclic && flags != X509ChainStatusFlags.InvalidExtension && flags != X509ChainStatusFlags.InvalidPolicyConstraints && flags != X509ChainStatusFlags.InvalidBasicConstraints && flags != X509ChainStatusFlags.InvalidNameConstraints && flags != X509ChainStatusFlags.HasNotSupportedNameConstraint && flags != X509ChainStatusFlags.HasNotDefinedNameConstraint && flags != X509ChainStatusFlags.HasNotPermittedNameConstraint && flags != X509ChainStatusFlags.HasExcludedNameConstraint && flags != X509ChainStatusFlags.PartialChain && flags != X509ChainStatusFlags.CtlNotTimeValid && flags != X509ChainStatusFlags.CtlNotSignatureValid && flags != X509ChainStatusFlags.CtlNotValidForUsage && flags != X509ChainStatusFlags.OfflineRevocation && flags != X509ChainStatusFlags.NoIssuanceChainPolicy)
|
||||
{
|
||||
goto IL_FF;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return global::Locale.GetText(flags.ToString());
|
||||
IL_FF:
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
// Token: 0x04001324 RID: 4900
|
||||
private X509ChainStatusFlags status;
|
||||
|
||||
// Token: 0x04001325 RID: 4901
|
||||
private string info;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
using System;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Defines the status of an X509 chain.</summary>
|
||||
// Token: 0x02000293 RID: 659
|
||||
[Flags]
|
||||
public enum X509ChainStatusFlags
|
||||
{
|
||||
/// <summary>Specifies that the X509 chain has no errors.</summary>
|
||||
// Token: 0x04001327 RID: 4903
|
||||
NoError = 0,
|
||||
/// <summary>Specifies that the X509 chain is not valid due to an invalid time value, such as a value that indicates an expired certificate.</summary>
|
||||
// Token: 0x04001328 RID: 4904
|
||||
NotTimeValid = 1,
|
||||
/// <summary>Deprecated, this flag has no effect. </summary>
|
||||
// Token: 0x04001329 RID: 4905
|
||||
NotTimeNested = 2,
|
||||
/// <summary>Specifies that the X509 chain is invalid due to a revoked certificate.</summary>
|
||||
// Token: 0x0400132A RID: 4906
|
||||
Revoked = 4,
|
||||
/// <summary>Specifies that the X509 chain is invalid due to an invalid certificate signature.</summary>
|
||||
// Token: 0x0400132B RID: 4907
|
||||
NotSignatureValid = 8,
|
||||
/// <summary>Specifies that the key usage is not valid.</summary>
|
||||
// Token: 0x0400132C RID: 4908
|
||||
NotValidForUsage = 16,
|
||||
/// <summary>Specifies that the X509 chain is invalid due to an untrusted root certificate.</summary>
|
||||
// Token: 0x0400132D RID: 4909
|
||||
UntrustedRoot = 32,
|
||||
/// <summary>Specifies that it is not possible to determine whether the certificate has been revoked. This can be due to the certificate revocation list (CRL) being offline or unavailable.</summary>
|
||||
// Token: 0x0400132E RID: 4910
|
||||
RevocationStatusUnknown = 64,
|
||||
/// <summary>Specifies that the X509 chain could not be built.</summary>
|
||||
// Token: 0x0400132F RID: 4911
|
||||
Cyclic = 128,
|
||||
/// <summary>Specifies that the X509 chain is invalid due to an invalid extension.</summary>
|
||||
// Token: 0x04001330 RID: 4912
|
||||
InvalidExtension = 256,
|
||||
/// <summary>Specifies that the X509 chain is invalid due to invalid policy constraints.</summary>
|
||||
// Token: 0x04001331 RID: 4913
|
||||
InvalidPolicyConstraints = 512,
|
||||
/// <summary>Specifies that the X509 chain is invalid due to invalid basic constraints.</summary>
|
||||
// Token: 0x04001332 RID: 4914
|
||||
InvalidBasicConstraints = 1024,
|
||||
/// <summary>Specifies that the X509 chain is invalid due to invalid name constraints.</summary>
|
||||
// Token: 0x04001333 RID: 4915
|
||||
InvalidNameConstraints = 2048,
|
||||
/// <summary>Specifies that the certificate does not have a supported name constant or has a name constant that is unsupported.</summary>
|
||||
// Token: 0x04001334 RID: 4916
|
||||
HasNotSupportedNameConstraint = 4096,
|
||||
/// <summary>Specifies that the certificate has an undefined name constant.</summary>
|
||||
// Token: 0x04001335 RID: 4917
|
||||
HasNotDefinedNameConstraint = 8192,
|
||||
/// <summary>Specifies that the certificate has an impermissible name constraint.</summary>
|
||||
// Token: 0x04001336 RID: 4918
|
||||
HasNotPermittedNameConstraint = 16384,
|
||||
/// <summary>Specifies that the X509 chain is invalid because a certificate has excluded a name constraint.</summary>
|
||||
// Token: 0x04001337 RID: 4919
|
||||
HasExcludedNameConstraint = 32768,
|
||||
/// <summary>Specifies that the X509 chain could not be built up to the root certificate.</summary>
|
||||
// Token: 0x04001338 RID: 4920
|
||||
PartialChain = 65536,
|
||||
/// <summary>Specifies that the certificate trust list (CTL) is not valid because of an invalid time value, such as one that indicates that the CTL has expired.</summary>
|
||||
// Token: 0x04001339 RID: 4921
|
||||
CtlNotTimeValid = 131072,
|
||||
/// <summary>Specifies that the certificate trust list (CTL) contains an invalid signature.</summary>
|
||||
// Token: 0x0400133A RID: 4922
|
||||
CtlNotSignatureValid = 262144,
|
||||
/// <summary>Specifies that the certificate trust list (CTL) is not valid for this use.</summary>
|
||||
// Token: 0x0400133B RID: 4923
|
||||
CtlNotValidForUsage = 524288,
|
||||
/// <summary>Specifies that the online certificate revocation list (CRL) the X509 chain relies on is currently offline.</summary>
|
||||
// Token: 0x0400133C RID: 4924
|
||||
OfflineRevocation = 16777216,
|
||||
/// <summary>Specifies that there is no certificate policy extension in the certificate. This error would occur if a group policy has specified that all certificates must have a certificate policy.</summary>
|
||||
// Token: 0x0400133D RID: 4925
|
||||
NoIssuanceChainPolicy = 33554432
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,225 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Mono.Security;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Defines the collection of object identifiers (OIDs) that indicates the applications that use the key. This class cannot be inherited.</summary>
|
||||
// Token: 0x02000294 RID: 660
|
||||
public sealed class X509EnhancedKeyUsageExtension : X509Extension
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509EnhancedKeyUsageExtension" /> class.</summary>
|
||||
// Token: 0x06001857 RID: 6231 RVA: 0x00052A48 File Offset: 0x00050C48
|
||||
public X509EnhancedKeyUsageExtension()
|
||||
{
|
||||
this._oid = new Oid("2.5.29.37", "Enhanced Key Usage");
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509EnhancedKeyUsageExtension" /> class using an <see cref="T:System.Security.Cryptography.AsnEncodedData" /> object and a value that identifies whether the extension is critical.</summary>
|
||||
/// <param name="encodedEnhancedKeyUsages">The encoded data to use to create the extension.</param>
|
||||
/// <param name="critical">true if the extension is critical; otherwise, false.</param>
|
||||
// Token: 0x06001858 RID: 6232 RVA: 0x00052A68 File Offset: 0x00050C68
|
||||
public X509EnhancedKeyUsageExtension(AsnEncodedData encodedEnhancedKeyUsages, bool critical)
|
||||
{
|
||||
this._oid = new Oid("2.5.29.37", "Enhanced Key Usage");
|
||||
this._raw = encodedEnhancedKeyUsages.RawData;
|
||||
base.Critical = critical;
|
||||
this._status = this.Decode(base.RawData);
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509EnhancedKeyUsageExtension" /> class using an <see cref="T:System.Security.Cryptography.OidCollection" /> and a value that identifies whether the extension is critical. </summary>
|
||||
/// <param name="enhancedKeyUsages">An <see cref="T:System.Security.Cryptography.OidCollection" /> collection. </param>
|
||||
/// <param name="critical">true if the extension is critical; otherwise, false.</param>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The specified <see cref="T:System.Security.Cryptography.OidCollection" /> contains one or more corrupt values.</exception>
|
||||
// Token: 0x06001859 RID: 6233 RVA: 0x00052AB8 File Offset: 0x00050CB8
|
||||
public X509EnhancedKeyUsageExtension(OidCollection enhancedKeyUsages, bool critical)
|
||||
{
|
||||
if (enhancedKeyUsages == null)
|
||||
{
|
||||
throw new ArgumentNullException("enhancedKeyUsages");
|
||||
}
|
||||
this._oid = new Oid("2.5.29.37", "Enhanced Key Usage");
|
||||
base.Critical = critical;
|
||||
this._enhKeyUsage = enhancedKeyUsages.ReadOnlyCopy();
|
||||
base.RawData = this.Encode();
|
||||
}
|
||||
|
||||
/// <summary>Gets the collection of object identifiers (OIDs) that indicate the applications that use the key.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.OidCollection" /> object indicating the applications that use the key.</returns>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x170007A8 RID: 1960
|
||||
// (get) Token: 0x0600185A RID: 6234 RVA: 0x00052B10 File Offset: 0x00050D10
|
||||
public OidCollection EnhancedKeyUsages
|
||||
{
|
||||
get
|
||||
{
|
||||
AsnDecodeStatus status = this._status;
|
||||
if (status != AsnDecodeStatus.Ok && status != AsnDecodeStatus.InformationNotAvailable)
|
||||
{
|
||||
throw new CryptographicException("Badly encoded extension.");
|
||||
}
|
||||
if (this._enhKeyUsage == null)
|
||||
{
|
||||
this._enhKeyUsage = new OidCollection();
|
||||
}
|
||||
this._enhKeyUsage.ReadOnly = true;
|
||||
return this._enhKeyUsage;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509EnhancedKeyUsageExtension" /> class using an <see cref="T:System.Security.Cryptography.AsnEncodedData" /> object.</summary>
|
||||
/// <param name="asnEncodedData">The encoded data to use to create the extension.</param>
|
||||
// Token: 0x0600185B RID: 6235 RVA: 0x00052B6C File Offset: 0x00050D6C
|
||||
public override void CopyFrom(AsnEncodedData asnEncodedData)
|
||||
{
|
||||
if (asnEncodedData == null)
|
||||
{
|
||||
throw new ArgumentNullException("encodedData");
|
||||
}
|
||||
X509Extension x509Extension = asnEncodedData as X509Extension;
|
||||
if (x509Extension == null)
|
||||
{
|
||||
throw new ArgumentException(global::Locale.GetText("Wrong type."), "asnEncodedData");
|
||||
}
|
||||
if (x509Extension._oid == null)
|
||||
{
|
||||
this._oid = new Oid("2.5.29.37", "Enhanced Key Usage");
|
||||
}
|
||||
else
|
||||
{
|
||||
this._oid = new Oid(x509Extension._oid);
|
||||
}
|
||||
base.RawData = x509Extension.RawData;
|
||||
base.Critical = x509Extension.Critical;
|
||||
this._status = this.Decode(base.RawData);
|
||||
}
|
||||
|
||||
// Token: 0x0600185C RID: 6236 RVA: 0x00052C0C File Offset: 0x00050E0C
|
||||
internal AsnDecodeStatus Decode(byte[] extension)
|
||||
{
|
||||
if (extension == null || extension.Length == 0)
|
||||
{
|
||||
return AsnDecodeStatus.BadAsn;
|
||||
}
|
||||
if (extension[0] != 48)
|
||||
{
|
||||
return AsnDecodeStatus.BadTag;
|
||||
}
|
||||
if (this._enhKeyUsage == null)
|
||||
{
|
||||
this._enhKeyUsage = new OidCollection();
|
||||
}
|
||||
try
|
||||
{
|
||||
ASN1 asn = new ASN1(extension);
|
||||
if (asn.Tag != 48)
|
||||
{
|
||||
throw new CryptographicException(global::Locale.GetText("Invalid ASN.1 Tag"));
|
||||
}
|
||||
for (int i = 0; i < asn.Count; i++)
|
||||
{
|
||||
this._enhKeyUsage.Add(new Oid(ASN1Convert.ToOid(asn[i])));
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
return AsnDecodeStatus.BadAsn;
|
||||
}
|
||||
return AsnDecodeStatus.Ok;
|
||||
}
|
||||
|
||||
// Token: 0x0600185D RID: 6237 RVA: 0x00052CD4 File Offset: 0x00050ED4
|
||||
internal byte[] Encode()
|
||||
{
|
||||
ASN1 asn = new ASN1(48);
|
||||
foreach (Oid oid in this._enhKeyUsage)
|
||||
{
|
||||
asn.Add(ASN1Convert.FromOid(oid.Value));
|
||||
}
|
||||
return asn.GetBytes();
|
||||
}
|
||||
|
||||
// Token: 0x0600185E RID: 6238 RVA: 0x00052D24 File Offset: 0x00050F24
|
||||
internal override string ToString(bool multiLine)
|
||||
{
|
||||
switch (this._status)
|
||||
{
|
||||
case AsnDecodeStatus.BadAsn:
|
||||
return string.Empty;
|
||||
case AsnDecodeStatus.BadTag:
|
||||
case AsnDecodeStatus.BadLength:
|
||||
return base.FormatUnkownData(this._raw);
|
||||
case AsnDecodeStatus.InformationNotAvailable:
|
||||
return "Information Not Available";
|
||||
default:
|
||||
{
|
||||
if (this._oid.Value != "2.5.29.37")
|
||||
{
|
||||
return string.Format("Unknown Key Usage ({0})", this._oid.Value);
|
||||
}
|
||||
if (this._enhKeyUsage.Count == 0)
|
||||
{
|
||||
return "Information Not Available";
|
||||
}
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
int i = 0;
|
||||
while (i < this._enhKeyUsage.Count)
|
||||
{
|
||||
Oid oid = this._enhKeyUsage[i];
|
||||
string value = oid.Value;
|
||||
if (value == null)
|
||||
{
|
||||
goto IL_102;
|
||||
}
|
||||
if (X509EnhancedKeyUsageExtension.<>f__switch$mapE == null)
|
||||
{
|
||||
X509EnhancedKeyUsageExtension.<>f__switch$mapE = new Dictionary<string, int>(1) { { "1.3.6.1.5.5.7.3.1", 0 } };
|
||||
}
|
||||
int num;
|
||||
if (!X509EnhancedKeyUsageExtension.<>f__switch$mapE.TryGetValue(value, out num))
|
||||
{
|
||||
goto IL_102;
|
||||
}
|
||||
if (num != 0)
|
||||
{
|
||||
goto IL_102;
|
||||
}
|
||||
stringBuilder.Append("Server Authentication (");
|
||||
IL_113:
|
||||
stringBuilder.Append(oid.Value);
|
||||
stringBuilder.Append(")");
|
||||
if (multiLine)
|
||||
{
|
||||
stringBuilder.Append(Environment.NewLine);
|
||||
}
|
||||
else if (i != this._enhKeyUsage.Count - 1)
|
||||
{
|
||||
stringBuilder.Append(", ");
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
IL_102:
|
||||
stringBuilder.Append("Unknown Key Usage (");
|
||||
goto IL_113;
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0400133E RID: 4926
|
||||
internal const string oid = "2.5.29.37";
|
||||
|
||||
// Token: 0x0400133F RID: 4927
|
||||
internal const string friendlyName = "Enhanced Key Usage";
|
||||
|
||||
// Token: 0x04001340 RID: 4928
|
||||
private OidCollection _enhKeyUsage;
|
||||
|
||||
// Token: 0x04001341 RID: 4929
|
||||
private AsnDecodeStatus _status;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Represents an X509 extension.</summary>
|
||||
// Token: 0x02000295 RID: 661
|
||||
public class X509Extension : AsnEncodedData
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Extension" /> class.</summary>
|
||||
// Token: 0x0600185F RID: 6239 RVA: 0x00052EB0 File Offset: 0x000510B0
|
||||
protected X509Extension()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Extension" /> class.</summary>
|
||||
/// <param name="encodedExtension">The encoded data to be used to create the extension.</param>
|
||||
/// <param name="critical">true if the extension is critical; otherwise false.</param>
|
||||
// Token: 0x06001860 RID: 6240 RVA: 0x00052EB8 File Offset: 0x000510B8
|
||||
public X509Extension(AsnEncodedData encodedExtension, bool critical)
|
||||
{
|
||||
if (encodedExtension.Oid == null)
|
||||
{
|
||||
throw new ArgumentNullException("encodedExtension.Oid");
|
||||
}
|
||||
base.Oid = encodedExtension.Oid;
|
||||
base.RawData = encodedExtension.RawData;
|
||||
this._critical = critical;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Extension" /> class.</summary>
|
||||
/// <param name="oid">The object identifier used to identify the extension.</param>
|
||||
/// <param name="rawData">The encoded data used to create the extension.</param>
|
||||
/// <param name="critical">true if the extension is critical; otherwise false.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="oid" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="oid" /> is an empty string ("").</exception>
|
||||
// Token: 0x06001861 RID: 6241 RVA: 0x00052F00 File Offset: 0x00051100
|
||||
public X509Extension(Oid oid, byte[] rawData, bool critical)
|
||||
{
|
||||
if (oid == null)
|
||||
{
|
||||
throw new ArgumentNullException("oid");
|
||||
}
|
||||
base.Oid = oid;
|
||||
base.RawData = rawData;
|
||||
this._critical = critical;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Extension" /> class.</summary>
|
||||
/// <param name="oid">A string representing the object identifier.</param>
|
||||
/// <param name="rawData">The encoded data used to create the extension.</param>
|
||||
/// <param name="critical">true if the extension is critical; otherwise false.</param>
|
||||
// Token: 0x06001862 RID: 6242 RVA: 0x00052F3C File Offset: 0x0005113C
|
||||
public X509Extension(string oid, byte[] rawData, bool critical)
|
||||
: base(oid, rawData)
|
||||
{
|
||||
this._critical = critical;
|
||||
}
|
||||
|
||||
/// <summary>Gets a Boolean value indicating whether the extension is critical.</summary>
|
||||
/// <returns>true if the extension is critical; otherwise, false.</returns>
|
||||
// Token: 0x170007A9 RID: 1961
|
||||
// (get) Token: 0x06001863 RID: 6243 RVA: 0x00052F50 File Offset: 0x00051150
|
||||
// (set) Token: 0x06001864 RID: 6244 RVA: 0x00052F58 File Offset: 0x00051158
|
||||
public bool Critical
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._critical;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._critical = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Copies the extension properties of the specified <see cref="T:System.Security.Cryptography.AsnEncodedData" /> object.</summary>
|
||||
/// <param name="asnEncodedData">The <see cref="T:System.Security.Cryptography.AsnEncodedData" /> to be copied.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="asnEncodedData" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="asnEncodedData" /> does not have a valid X.509 extension.</exception>
|
||||
// Token: 0x06001865 RID: 6245 RVA: 0x00052F64 File Offset: 0x00051164
|
||||
public override void CopyFrom(AsnEncodedData asnEncodedData)
|
||||
{
|
||||
if (asnEncodedData == null)
|
||||
{
|
||||
throw new ArgumentNullException("encodedData");
|
||||
}
|
||||
X509Extension x509Extension = asnEncodedData as X509Extension;
|
||||
if (x509Extension == null)
|
||||
{
|
||||
throw new ArgumentException(global::Locale.GetText("Expected a X509Extension instance."));
|
||||
}
|
||||
base.CopyFrom(asnEncodedData);
|
||||
this._critical = x509Extension.Critical;
|
||||
}
|
||||
|
||||
// Token: 0x06001866 RID: 6246 RVA: 0x00052FB4 File Offset: 0x000511B4
|
||||
internal string FormatUnkownData(byte[] data)
|
||||
{
|
||||
if (data == null || data.Length == 0)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (int i = 0; i < data.Length; i++)
|
||||
{
|
||||
stringBuilder.Append(data[i].ToString("X2"));
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
// Token: 0x04001343 RID: 4931
|
||||
private bool _critical;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,221 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Mono.Security;
|
||||
using Mono.Security.X509;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Represents a collection of <see cref="T:System.Security.Cryptography.X509Certificates.X509Extension" /> objects. This class cannot be inherited.</summary>
|
||||
// Token: 0x02000296 RID: 662
|
||||
public sealed class X509ExtensionCollection : ICollection, IEnumerable
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509ExtensionCollection" /> class. </summary>
|
||||
// Token: 0x06001867 RID: 6247 RVA: 0x00053010 File Offset: 0x00051210
|
||||
public X509ExtensionCollection()
|
||||
{
|
||||
this._list = new ArrayList();
|
||||
}
|
||||
|
||||
// Token: 0x06001868 RID: 6248 RVA: 0x00053024 File Offset: 0x00051224
|
||||
internal X509ExtensionCollection(X509Certificate cert)
|
||||
{
|
||||
this._list = new ArrayList(cert.Extensions.Count);
|
||||
if (cert.Extensions.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
object[] array = new object[2];
|
||||
foreach (object obj in cert.Extensions)
|
||||
{
|
||||
X509Extension x509Extension = (X509Extension)obj;
|
||||
bool critical = x509Extension.Critical;
|
||||
string oid = x509Extension.Oid;
|
||||
byte[] array2 = null;
|
||||
ASN1 value = x509Extension.Value;
|
||||
if (value.Tag == 4 && value.Count > 0)
|
||||
{
|
||||
array2 = value[0].GetBytes();
|
||||
}
|
||||
array[0] = new AsnEncodedData(oid, array2);
|
||||
array[1] = critical;
|
||||
X509Extension x509Extension2 = (X509Extension)CryptoConfig.CreateFromName(oid, array);
|
||||
if (x509Extension2 == null)
|
||||
{
|
||||
x509Extension2 = new X509Extension(oid, array2, critical);
|
||||
}
|
||||
this._list.Add(x509Extension2);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Copies the collection into an array starting at the specified index.</summary>
|
||||
/// <param name="array">An array of <see cref="T:System.Security.Cryptography.X509Certificates.X509Extension" /> objects. </param>
|
||||
/// <param name="index">The location in the array at which copying starts. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="index" /> is a zero-length string or contains an invalid value. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="index" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> specifies a value that is not in the range of the array. </exception>
|
||||
// Token: 0x06001869 RID: 6249 RVA: 0x0005314C File Offset: 0x0005134C
|
||||
void ICollection.CopyTo(Array array, int index)
|
||||
{
|
||||
if (array == null)
|
||||
{
|
||||
throw new ArgumentNullException("array");
|
||||
}
|
||||
if (index < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("negative index");
|
||||
}
|
||||
if (index >= array.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index >= array.Length");
|
||||
}
|
||||
this._list.CopyTo(array, index);
|
||||
}
|
||||
|
||||
/// <summary>Returns an enumerator that can iterate through an <see cref="T:System.Security.Cryptography.X509Certificates.X509ExtensionCollection" /> object.</summary>
|
||||
/// <returns>An <see cref="T:System.Collections.IEnumerator" /> object to use to iterate through the <see cref="T:System.Security.Cryptography.X509Certificates.X509ExtensionCollection" /> object.</returns>
|
||||
// Token: 0x0600186A RID: 6250 RVA: 0x000531A0 File Offset: 0x000513A0
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return new X509ExtensionEnumerator(this._list);
|
||||
}
|
||||
|
||||
/// <summary>Gets the number of <see cref="T:System.Security.Cryptography.X509Certificates.X509Extension" /> objects in a <see cref="T:System.Security.Cryptography.X509Certificates.X509ExtensionCollection" /> object.</summary>
|
||||
/// <returns>An integer representing the number of <see cref="T:System.Security.Cryptography.X509Certificates.X509Extension" /> objects in the <see cref="T:System.Security.Cryptography.X509Certificates.X509ExtensionCollection" /> object.</returns>
|
||||
// Token: 0x170007AA RID: 1962
|
||||
// (get) Token: 0x0600186B RID: 6251 RVA: 0x000531B0 File Offset: 0x000513B0
|
||||
public int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._list.Count;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a value indicating whether the collection is guaranteed to be thread safe.</summary>
|
||||
/// <returns>true if the collection is thread safe; otherwise, false.</returns>
|
||||
// Token: 0x170007AB RID: 1963
|
||||
// (get) Token: 0x0600186C RID: 6252 RVA: 0x000531C0 File Offset: 0x000513C0
|
||||
public bool IsSynchronized
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._list.IsSynchronized;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets an object that you can use to synchronize access to the <see cref="T:System.Security.Cryptography.X509Certificates.X509ExtensionCollection" /> object.</summary>
|
||||
/// <returns>An object that you can use to synchronize access to the <see cref="T:System.Security.Cryptography.X509Certificates.X509ExtensionCollection" /> object.</returns>
|
||||
// Token: 0x170007AC RID: 1964
|
||||
// (get) Token: 0x0600186D RID: 6253 RVA: 0x000531D0 File Offset: 0x000513D0
|
||||
public object SyncRoot
|
||||
{
|
||||
get
|
||||
{
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the <see cref="T:System.Security.Cryptography.X509Certificates.X509Extension" /> object at the specified index.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.X509Certificates.X509Extension" /> object.</returns>
|
||||
/// <param name="index">The location of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Extension" /> object to retrieve. </param>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="index" /> is less than zero. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> is equal to or greater than the length of the array. </exception>
|
||||
// Token: 0x170007AD RID: 1965
|
||||
public X509Extension this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (index < 0)
|
||||
{
|
||||
throw new InvalidOperationException("index");
|
||||
}
|
||||
return (X509Extension)this._list[index];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the first <see cref="T:System.Security.Cryptography.X509Certificates.X509Extension" /> object whose value or friendly name is specified by an object identifier (OID).</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.X509Certificates.X509Extension" /> object.</returns>
|
||||
/// <param name="oid">The object identifier (OID) of the extension to retrieve. </param>
|
||||
// Token: 0x170007AE RID: 1966
|
||||
public X509Extension this[string oid]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (oid == null)
|
||||
{
|
||||
throw new ArgumentNullException("oid");
|
||||
}
|
||||
if (this._list.Count == 0 || oid.Length == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
foreach (object obj in this._list)
|
||||
{
|
||||
X509Extension x509Extension = (X509Extension)obj;
|
||||
if (x509Extension.Oid.Value.Equals(oid))
|
||||
{
|
||||
return x509Extension;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Adds an <see cref="T:System.Security.Cryptography.X509Certificates.X509Extension" /> object to an <see cref="T:System.Security.Cryptography.X509Certificates.X509ExtensionCollection" /> object.</summary>
|
||||
/// <returns>The index at which the <paramref name="extension" /> parameter was added.</returns>
|
||||
/// <param name="extension">An <see cref="T:System.Security.Cryptography.X509Certificates.X509Extension" /> object to add to the <see cref="T:System.Security.Cryptography.X509Certificates.X509ExtensionCollection" /> object. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">The value of the <paramref name="extension" /> parameter is null.</exception>
|
||||
// Token: 0x06001870 RID: 6256 RVA: 0x000532B4 File Offset: 0x000514B4
|
||||
public int Add(X509Extension extension)
|
||||
{
|
||||
if (extension == null)
|
||||
{
|
||||
throw new ArgumentNullException("extension");
|
||||
}
|
||||
return this._list.Add(extension);
|
||||
}
|
||||
|
||||
/// <summary>Copies a collection into an array starting at the specified index.</summary>
|
||||
/// <param name="array">An array of <see cref="T:System.Security.Cryptography.X509Certificates.X509Extension" /> objects. </param>
|
||||
/// <param name="index">The location in the array at which copying starts. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="index" /> is a zero-length string or contains an invalid value. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="index" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> specifies a value that is not in the range of the array. </exception>
|
||||
// Token: 0x06001871 RID: 6257 RVA: 0x000532D4 File Offset: 0x000514D4
|
||||
public void CopyTo(X509Extension[] array, int index)
|
||||
{
|
||||
if (array == null)
|
||||
{
|
||||
throw new ArgumentNullException("array");
|
||||
}
|
||||
if (index < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("negative index");
|
||||
}
|
||||
if (index >= array.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index >= array.Length");
|
||||
}
|
||||
this._list.CopyTo(array, index);
|
||||
}
|
||||
|
||||
/// <summary>Returns an enumerator that can iterate through an <see cref="T:System.Security.Cryptography.X509Certificates.X509ExtensionCollection" /> object.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.X509Certificates.X509ExtensionEnumerator" /> object to use to iterate through the <see cref="T:System.Security.Cryptography.X509Certificates.X509ExtensionCollection" /> object.</returns>
|
||||
// Token: 0x06001872 RID: 6258 RVA: 0x00053328 File Offset: 0x00051528
|
||||
public X509ExtensionEnumerator GetEnumerator()
|
||||
{
|
||||
return new X509ExtensionEnumerator(this._list);
|
||||
}
|
||||
|
||||
// Token: 0x04001344 RID: 4932
|
||||
private ArrayList _list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Supports a simple iteration over a <see cref="T:System.Security.Cryptography.X509Certificates.X509ExtensionCollection" />. This class cannot be inherited.</summary>
|
||||
// Token: 0x02000297 RID: 663
|
||||
public sealed class X509ExtensionEnumerator : IEnumerator
|
||||
{
|
||||
// Token: 0x06001873 RID: 6259 RVA: 0x00053338 File Offset: 0x00051538
|
||||
internal X509ExtensionEnumerator(ArrayList list)
|
||||
{
|
||||
this.enumerator = list.GetEnumerator();
|
||||
}
|
||||
|
||||
/// <summary>Gets an object from a collection.</summary>
|
||||
/// <returns>The current element in the <see cref="T:System.Security.Cryptography.X509Certificates.X509ExtensionCollection" />.</returns>
|
||||
/// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element. </exception>
|
||||
// Token: 0x170007AF RID: 1967
|
||||
// (get) Token: 0x06001874 RID: 6260 RVA: 0x0005334C File Offset: 0x0005154C
|
||||
object IEnumerator.Current
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.enumerator.Current;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the current element in the <see cref="T:System.Security.Cryptography.X509Certificates.X509ExtensionCollection" />.</summary>
|
||||
/// <returns>The current element in the <see cref="T:System.Security.Cryptography.X509Certificates.X509ExtensionCollection" />.</returns>
|
||||
/// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element. </exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x170007B0 RID: 1968
|
||||
// (get) Token: 0x06001875 RID: 6261 RVA: 0x0005335C File Offset: 0x0005155C
|
||||
public X509Extension Current
|
||||
{
|
||||
get
|
||||
{
|
||||
return (X509Extension)this.enumerator.Current;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Advances the enumerator to the next element in the <see cref="T:System.Security.Cryptography.X509Certificates.X509ExtensionCollection" />.</summary>
|
||||
/// <returns>true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.</returns>
|
||||
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception>
|
||||
// Token: 0x06001876 RID: 6262 RVA: 0x00053370 File Offset: 0x00051570
|
||||
public bool MoveNext()
|
||||
{
|
||||
return this.enumerator.MoveNext();
|
||||
}
|
||||
|
||||
/// <summary>Sets the enumerator to its initial position, which is before the first element in the <see cref="T:System.Security.Cryptography.X509Certificates.X509ExtensionCollection" />.</summary>
|
||||
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception>
|
||||
// Token: 0x06001877 RID: 6263 RVA: 0x00053380 File Offset: 0x00051580
|
||||
public void Reset()
|
||||
{
|
||||
this.enumerator.Reset();
|
||||
}
|
||||
|
||||
// Token: 0x04001345 RID: 4933
|
||||
private IEnumerator enumerator;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Specifies the type of value the <see cref="M:System.Security.Cryptography.X509Certificates.X509Certificate2Collection.Find(System.Security.Cryptography.X509Certificates.X509FindType,System.Object,System.Boolean)" /> method searches for.</summary>
|
||||
// Token: 0x02000298 RID: 664
|
||||
public enum X509FindType
|
||||
{
|
||||
/// <summary>The <paramref name="findValue" /> parameter for the <see cref="M:System.Security.Cryptography.X509Certificates.X509Certificate2Collection.Find(System.Security.Cryptography.X509Certificates.X509FindType,System.Object,System.Boolean)" /> method must be a string representing the thumbprint of the certificate.</summary>
|
||||
// Token: 0x04001347 RID: 4935
|
||||
FindByThumbprint,
|
||||
/// <summary>The <paramref name="findValue" /> parameter for the <see cref="M:System.Security.Cryptography.X509Certificates.X509Certificate2Collection.Find(System.Security.Cryptography.X509Certificates.X509FindType,System.Object,System.Boolean)" /> method must be a string representing the subject name of the certificate. This is a less specific search than that provided by the <see cref="F:System.Security.Cryptography.X509Certificates.X509FindType.FindBySubjectDistinguishedName" /> enumeration value. Using the <see cref="F:System.Security.Cryptography.X509Certificates.X509FindType.FindBySubjectName" /> value, the <see cref="M:System.Security.Cryptography.X509Certificates.X509Certificate2Collection.Find(System.Security.Cryptography.X509Certificates.X509FindType,System.Object,System.Boolean)" /> method performs a case-insensitive string comparison using the supplied value. For example, if you pass "MyCert" to the <see cref="M:System.Security.Cryptography.X509Certificates.X509Certificate2Collection.Find(System.Security.Cryptography.X509Certificates.X509FindType,System.Object,System.Boolean)" /> method, it will find all certificates with the subject name containing that string, regardless of other subject values. Searching by distinguished name is a more precise search.</summary>
|
||||
// Token: 0x04001348 RID: 4936
|
||||
FindBySubjectName,
|
||||
/// <summary>The <paramref name="findValue" /> parameter for the <see cref="M:System.Security.Cryptography.X509Certificates.X509Certificate2Collection.Find(System.Security.Cryptography.X509Certificates.X509FindType,System.Object,System.Boolean)" /> method must be a string representing the subject distinguished name of the certificate. This is a more specific search than that provided by the <see cref="F:System.Security.Cryptography.X509Certificates.X509FindType.FindBySubjectName" /> enumeration value. Using the <see cref="F:System.Security.Cryptography.X509Certificates.X509FindType.FindBySubjectDistinguishedName" /> value, the <see cref="M:System.Security.Cryptography.X509Certificates.X509Certificate2Collection.Find(System.Security.Cryptography.X509Certificates.X509FindType,System.Object,System.Boolean)" /> method performs a case-insensitive string comparison for the entire distinguished name. Searching by subject name is a less precise search.</summary>
|
||||
// Token: 0x04001349 RID: 4937
|
||||
FindBySubjectDistinguishedName,
|
||||
/// <summary>The <paramref name="findValue" /> parameter for the <see cref="M:System.Security.Cryptography.X509Certificates.X509Certificate2Collection.Find(System.Security.Cryptography.X509Certificates.X509FindType,System.Object,System.Boolean)" /> method must be a string representing the issuer name of the certificate. This is a less specific search than that provided by the <see cref="F:System.Security.Cryptography.X509Certificates.X509FindType.FindByIssuerDistinguishedName" /> enumeration value. Using the <see cref="F:System.Security.Cryptography.X509Certificates.X509FindType.FindByIssuerName" /> value, the <see cref="M:System.Security.Cryptography.X509Certificates.X509Certificate2Collection.Find(System.Security.Cryptography.X509Certificates.X509FindType,System.Object,System.Boolean)" /> method performs a case-insensitive string comparison using the supplied value. For example, if you pass "MyCA" to the <see cref="M:System.Security.Cryptography.X509Certificates.X509Certificate2Collection.Find(System.Security.Cryptography.X509Certificates.X509FindType,System.Object,System.Boolean)" /> method, it will find all certificates with the issuer name containing that string, regardless of other issuer values.</summary>
|
||||
// Token: 0x0400134A RID: 4938
|
||||
FindByIssuerName,
|
||||
/// <summary>The <paramref name="findValue" /> parameter for the <see cref="M:System.Security.Cryptography.X509Certificates.X509Certificate2Collection.Find(System.Security.Cryptography.X509Certificates.X509FindType,System.Object,System.Boolean)" /> method must be a string representing the issuer distinguished name of the certificate. This is a more specific search than that provided by the <see cref="F:System.Security.Cryptography.X509Certificates.X509FindType.FindByIssuerName" /> enumeration value. Using the <see cref="F:System.Security.Cryptography.X509Certificates.X509FindType.FindByIssuerDistinguishedName" /> value, the <see cref="M:System.Security.Cryptography.X509Certificates.X509Certificate2Collection.Find(System.Security.Cryptography.X509Certificates.X509FindType,System.Object,System.Boolean)" /> method performs a case-insensitive string comparison for the entire distinguished name. Searching by issuer name is a less precise search.</summary>
|
||||
// Token: 0x0400134B RID: 4939
|
||||
FindByIssuerDistinguishedName,
|
||||
/// <summary>The <paramref name="findValue" /> parameter for the <see cref="M:System.Security.Cryptography.X509Certificates.X509Certificate2Collection.Find(System.Security.Cryptography.X509Certificates.X509FindType,System.Object,System.Boolean)" /> method must be a string representing the serial number of the certificate as it is displayed by the UI. The serial number must be in reverse order because it is an integer.</summary>
|
||||
// Token: 0x0400134C RID: 4940
|
||||
FindBySerialNumber,
|
||||
/// <summary>The <paramref name="findValue" /> parameter for the <see cref="M:System.Security.Cryptography.X509Certificates.X509Certificate2Collection.Find(System.Security.Cryptography.X509Certificates.X509FindType,System.Object,System.Boolean)" /> method must be a <see cref="T:System.DateTime" /> value in local time. You can use <see cref="P:System.DateTime.Now" /> to find all the currently valid certificates.</summary>
|
||||
// Token: 0x0400134D RID: 4941
|
||||
FindByTimeValid,
|
||||
/// <summary>The <paramref name="findValue" /> parameter for the <see cref="M:System.Security.Cryptography.X509Certificates.X509Certificate2Collection.Find(System.Security.Cryptography.X509Certificates.X509FindType,System.Object,System.Boolean)" /> method must be a <see cref="T:System.DateTime" /> value in local time. The value does not have to be in the future. For example, you can use <see cref="F:System.Security.Cryptography.X509Certificates.X509FindType.FindByTimeNotYetValid" /> to find certificates that became valid in the current year by taking the intersection of the results of a <see cref="M:System.Security.Cryptography.X509Certificates.X509Certificate2Collection.Find(System.Security.Cryptography.X509Certificates.X509FindType,System.Object,System.Boolean)" /> operation for <see cref="F:System.Security.Cryptography.X509Certificates.X509FindType.FindByTimeNotYetValid" /> for the last day of last year with the results of a <see cref="M:System.Security.Cryptography.X509Certificates.X509Certificate2Collection.Find(System.Security.Cryptography.X509Certificates.X509FindType,System.Object,System.Boolean)" /> operation for <see cref="F:System.Security.Cryptography.X509Certificates.X509FindType.FindByTimeValid" /> of <see cref="P:System.DateTime.Now" />. </summary>
|
||||
// Token: 0x0400134E RID: 4942
|
||||
FindByTimeNotYetValid,
|
||||
/// <summary>The <paramref name="findValue" /> parameter for the <see cref="M:System.Security.Cryptography.X509Certificates.X509Certificate2Collection.Find(System.Security.Cryptography.X509Certificates.X509FindType,System.Object,System.Boolean)" /> method must be a <see cref="T:System.DateTime" /> value in local time. For example, you can find all the certificates that will be valid until the end of the year by eliminating the results of a <see cref="M:System.Security.Cryptography.X509Certificates.X509Certificate2Collection.Find(System.Security.Cryptography.X509Certificates.X509FindType,System.Object,System.Boolean)" /> operation for <see cref="F:System.Security.Cryptography.X509Certificates.X509FindType.FindByTimeExpired" /> of the last day of the year from the results of a <see cref="M:System.Security.Cryptography.X509Certificates.X509Certificate2Collection.Find(System.Security.Cryptography.X509Certificates.X509FindType,System.Object,System.Boolean)" /> operation for <see cref="P:System.DateTime.Now" />.</summary>
|
||||
// Token: 0x0400134F RID: 4943
|
||||
FindByTimeExpired,
|
||||
/// <summary>The <paramref name="findValue" /> parameter for the <see cref="M:System.Security.Cryptography.X509Certificates.X509Certificate2Collection.Find(System.Security.Cryptography.X509Certificates.X509FindType,System.Object,System.Boolean)" /> method must be a string representing the template name of the certificate, such as "ClientAuth". A template name is an X509 version 3 extension that specifies the uses of the certificate.</summary>
|
||||
// Token: 0x04001350 RID: 4944
|
||||
FindByTemplateName,
|
||||
/// <summary>The <paramref name="findValue" /> parameter for the <see cref="M:System.Security.Cryptography.X509Certificates.X509Certificate2Collection.Find(System.Security.Cryptography.X509Certificates.X509FindType,System.Object,System.Boolean)" /> method must be a string representing either the application policy friendly name or the object identifier (OID, or <see cref="T:System.Security.Cryptography.Oid" />) of the certificate. For example, "Encrypting File System" or "1.3.6.1.4.1.311.10.3.4" can be used. For an application that will be localized, the OID value must be used, because the friendly name is localized.</summary>
|
||||
// Token: 0x04001351 RID: 4945
|
||||
FindByApplicationPolicy,
|
||||
/// <summary>The <paramref name="findValue" /> parameter for the <see cref="M:System.Security.Cryptography.X509Certificates.X509Certificate2Collection.Find(System.Security.Cryptography.X509Certificates.X509FindType,System.Object,System.Boolean)" /> method must be a string representing either the friendly name or the object identifier (OID, or <see cref="T:System.Security.Cryptography.Oid" />) of the certificate policy. The best practice is to use the OID, such as "1.3.6.1.4.1.311.10.3.4". For an application that will be localized, the OID must be used, because the friendly name is localized.</summary>
|
||||
// Token: 0x04001352 RID: 4946
|
||||
FindByCertificatePolicy,
|
||||
/// <summary>The <paramref name="findValue" /> parameter for the <see cref="M:System.Security.Cryptography.X509Certificates.X509Certificate2Collection.Find(System.Security.Cryptography.X509Certificates.X509FindType,System.Object,System.Boolean)" /> method must be a string describing the extension to find. The object identifier (OID) is most commonly used to direct the <see cref="M:System.Security.Cryptography.X509Certificates.X509Certificate2Collection.Find(System.Security.Cryptography.X509Certificates.X509FindType,System.Object,System.Boolean)" /> method to search for all certificates that have an extension matching that OID value.</summary>
|
||||
// Token: 0x04001353 RID: 4947
|
||||
FindByExtension,
|
||||
/// <summary>The <paramref name="findValue" /> parameter for the <see cref="M:System.Security.Cryptography.X509Certificates.X509Certificate2Collection.Find(System.Security.Cryptography.X509Certificates.X509FindType,System.Object,System.Boolean)" /> method must be either a string representing the key usage or an integer representing a bit mask containing all the requested key usages. For the string value, only one key usage at a time can be specified, but the <see cref="M:System.Security.Cryptography.X509Certificates.X509Certificate2Collection.Find(System.Security.Cryptography.X509Certificates.X509FindType,System.Object,System.Boolean)" /> method can be used in a cascading sequence to get the intersection of the requested usages. For example, the <paramref name="findValue" /> parameter can be set to "KeyEncipherment" or an integer (0x30 indicates "KeyEncipherment" and "DataEncipherment"). Values of the <see cref="T:System.Security.Cryptography.X509Certificates.X509KeyUsageFlags" /> enumeration can also be used.</summary>
|
||||
// Token: 0x04001354 RID: 4948
|
||||
FindByKeyUsage,
|
||||
/// <summary>The <paramref name="findValue" /> parameter for the <see cref="M:System.Security.Cryptography.X509Certificates.X509Certificate2Collection.Find(System.Security.Cryptography.X509Certificates.X509FindType,System.Object,System.Boolean)" /> method must be a string representing the subject key identifier in hexadecimal, such as "F3E815D45E83B8477B9284113C64EF208E897112", as displayed in the UI.</summary>
|
||||
// Token: 0x04001355 RID: 4949
|
||||
FindBySubjectKeyIdentifier
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Specifies how much of the X.509 certificate chain should be included in the X.509 data.</summary>
|
||||
// Token: 0x02000299 RID: 665
|
||||
public enum X509IncludeOption
|
||||
{
|
||||
/// <summary>No X.509 chain information is included.</summary>
|
||||
// Token: 0x04001357 RID: 4951
|
||||
None,
|
||||
/// <summary>The entire X.509 chain is included except for the root certificate.</summary>
|
||||
// Token: 0x04001358 RID: 4952
|
||||
ExcludeRoot,
|
||||
/// <summary>Only the end certificate is included in the X.509 chain information.</summary>
|
||||
// Token: 0x04001359 RID: 4953
|
||||
EndCertOnly,
|
||||
/// <summary>The entire X.509 chain is included.</summary>
|
||||
// Token: 0x0400135A RID: 4954
|
||||
WholeChain
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,297 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using Mono.Security;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Defines the usage of a key contained within an X.509 certificate. This class cannot be inherited.</summary>
|
||||
// Token: 0x0200029A RID: 666
|
||||
public sealed class X509KeyUsageExtension : X509Extension
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509KeyUsageExtension" /> class.</summary>
|
||||
// Token: 0x06001878 RID: 6264 RVA: 0x00053390 File Offset: 0x00051590
|
||||
public X509KeyUsageExtension()
|
||||
{
|
||||
this._oid = new Oid("2.5.29.15", "Key Usage");
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509KeyUsageExtension" /> class using an <see cref="T:System.Security.Cryptography.AsnEncodedData" /> object and a value that identifies whether the extension is critical. </summary>
|
||||
/// <param name="encodedKeyUsage">The encoded data to use to create the extension.</param>
|
||||
/// <param name="critical">true if the extension is critical; otherwise, false.</param>
|
||||
// Token: 0x06001879 RID: 6265 RVA: 0x000533B0 File Offset: 0x000515B0
|
||||
public X509KeyUsageExtension(AsnEncodedData encodedKeyUsage, bool critical)
|
||||
{
|
||||
this._oid = new Oid("2.5.29.15", "Key Usage");
|
||||
this._raw = encodedKeyUsage.RawData;
|
||||
base.Critical = critical;
|
||||
this._status = this.Decode(base.RawData);
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509KeyUsageExtension" /> class using the specified <see cref="T:System.Security.Cryptography.X509Certificates.X509KeyUsageFlags" /> value and a value that identifies whether the extension is critical. </summary>
|
||||
/// <param name="keyUsages">One of the <see cref="T:System.Security.Cryptography.X509Certificates.X509KeyUsageFlags" /> values that describes how to use the key.</param>
|
||||
/// <param name="critical">true if the extension is critical; otherwise, false.</param>
|
||||
// Token: 0x0600187A RID: 6266 RVA: 0x00053400 File Offset: 0x00051600
|
||||
public X509KeyUsageExtension(X509KeyUsageFlags keyUsages, bool critical)
|
||||
{
|
||||
this._oid = new Oid("2.5.29.15", "Key Usage");
|
||||
base.Critical = critical;
|
||||
this._keyUsages = this.GetValidFlags(keyUsages);
|
||||
base.RawData = this.Encode();
|
||||
}
|
||||
|
||||
/// <summary>Gets the key usage flag associated with the certificate.</summary>
|
||||
/// <returns>One of the <see cref="P:System.Security.Cryptography.X509Certificates.X509KeyUsageExtension.KeyUsages" /> values.</returns>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The extension cannot be decoded. </exception>
|
||||
// Token: 0x170007B1 RID: 1969
|
||||
// (get) Token: 0x0600187B RID: 6267 RVA: 0x00053448 File Offset: 0x00051648
|
||||
public X509KeyUsageFlags KeyUsages
|
||||
{
|
||||
get
|
||||
{
|
||||
AsnDecodeStatus status = this._status;
|
||||
if (status != AsnDecodeStatus.Ok && status != AsnDecodeStatus.InformationNotAvailable)
|
||||
{
|
||||
throw new CryptographicException("Badly encoded extension.");
|
||||
}
|
||||
return this._keyUsages;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509KeyUsageExtension" /> class using an <see cref="T:System.Security.Cryptography.AsnEncodedData" /> object. </summary>
|
||||
/// <param name="asnEncodedData">The encoded data to use to create the extension.</param>
|
||||
// Token: 0x0600187C RID: 6268 RVA: 0x00053480 File Offset: 0x00051680
|
||||
public override void CopyFrom(AsnEncodedData encodedData)
|
||||
{
|
||||
if (encodedData == null)
|
||||
{
|
||||
throw new ArgumentNullException("encodedData");
|
||||
}
|
||||
X509Extension x509Extension = encodedData as X509Extension;
|
||||
if (x509Extension == null)
|
||||
{
|
||||
throw new ArgumentException(global::Locale.GetText("Wrong type."), "encodedData");
|
||||
}
|
||||
if (x509Extension._oid == null)
|
||||
{
|
||||
this._oid = new Oid("2.5.29.15", "Key Usage");
|
||||
}
|
||||
else
|
||||
{
|
||||
this._oid = new Oid(x509Extension._oid);
|
||||
}
|
||||
base.RawData = x509Extension.RawData;
|
||||
base.Critical = x509Extension.Critical;
|
||||
this._status = this.Decode(base.RawData);
|
||||
}
|
||||
|
||||
// Token: 0x0600187D RID: 6269 RVA: 0x00053520 File Offset: 0x00051720
|
||||
internal X509KeyUsageFlags GetValidFlags(X509KeyUsageFlags flags)
|
||||
{
|
||||
if ((flags & (X509KeyUsageFlags.EncipherOnly | X509KeyUsageFlags.CrlSign | X509KeyUsageFlags.KeyCertSign | X509KeyUsageFlags.KeyAgreement | X509KeyUsageFlags.DataEncipherment | X509KeyUsageFlags.KeyEncipherment | X509KeyUsageFlags.NonRepudiation | X509KeyUsageFlags.DigitalSignature | X509KeyUsageFlags.DecipherOnly)) != flags)
|
||||
{
|
||||
return X509KeyUsageFlags.None;
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
// Token: 0x0600187E RID: 6270 RVA: 0x00053534 File Offset: 0x00051734
|
||||
internal AsnDecodeStatus Decode(byte[] extension)
|
||||
{
|
||||
if (extension == null || extension.Length == 0)
|
||||
{
|
||||
return AsnDecodeStatus.BadAsn;
|
||||
}
|
||||
if (extension[0] != 3)
|
||||
{
|
||||
return AsnDecodeStatus.BadTag;
|
||||
}
|
||||
if (extension.Length < 3)
|
||||
{
|
||||
return AsnDecodeStatus.BadLength;
|
||||
}
|
||||
if (extension.Length < 4)
|
||||
{
|
||||
return AsnDecodeStatus.InformationNotAvailable;
|
||||
}
|
||||
try
|
||||
{
|
||||
ASN1 asn = new ASN1(extension);
|
||||
int num = 0;
|
||||
int i = 1;
|
||||
while (i < asn.Value.Length)
|
||||
{
|
||||
num = (num << 8) + (int)asn.Value[i++];
|
||||
}
|
||||
this._keyUsages = this.GetValidFlags((X509KeyUsageFlags)num);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return AsnDecodeStatus.BadAsn;
|
||||
}
|
||||
return AsnDecodeStatus.Ok;
|
||||
}
|
||||
|
||||
// Token: 0x0600187F RID: 6271 RVA: 0x000535E0 File Offset: 0x000517E0
|
||||
internal byte[] Encode()
|
||||
{
|
||||
int keyUsages = (int)this._keyUsages;
|
||||
byte b = 0;
|
||||
ASN1 asn;
|
||||
if (keyUsages == 0)
|
||||
{
|
||||
asn = new ASN1(3, new byte[] { b });
|
||||
}
|
||||
else
|
||||
{
|
||||
int num = ((keyUsages >= 255) ? (keyUsages >> 8) : keyUsages);
|
||||
while ((num & 1) == 0 && b < 8)
|
||||
{
|
||||
b += 1;
|
||||
num >>= 1;
|
||||
}
|
||||
if (keyUsages <= 255)
|
||||
{
|
||||
asn = new ASN1(3, new byte[]
|
||||
{
|
||||
b,
|
||||
(byte)keyUsages
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
asn = new ASN1(3, new byte[]
|
||||
{
|
||||
b,
|
||||
(byte)keyUsages,
|
||||
(byte)(keyUsages >> 8)
|
||||
});
|
||||
}
|
||||
}
|
||||
return asn.GetBytes();
|
||||
}
|
||||
|
||||
// Token: 0x06001880 RID: 6272 RVA: 0x00053690 File Offset: 0x00051890
|
||||
internal override string ToString(bool multiLine)
|
||||
{
|
||||
switch (this._status)
|
||||
{
|
||||
case AsnDecodeStatus.BadAsn:
|
||||
return string.Empty;
|
||||
case AsnDecodeStatus.BadTag:
|
||||
case AsnDecodeStatus.BadLength:
|
||||
return base.FormatUnkownData(this._raw);
|
||||
case AsnDecodeStatus.InformationNotAvailable:
|
||||
return "Information Not Available";
|
||||
default:
|
||||
{
|
||||
if (this._oid.Value != "2.5.29.15")
|
||||
{
|
||||
return string.Format("Unknown Key Usage ({0})", this._oid.Value);
|
||||
}
|
||||
if (this._keyUsages == X509KeyUsageFlags.None)
|
||||
{
|
||||
return "Information Not Available";
|
||||
}
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
if ((this._keyUsages & X509KeyUsageFlags.DigitalSignature) != X509KeyUsageFlags.None)
|
||||
{
|
||||
stringBuilder.Append("Digital Signature");
|
||||
}
|
||||
if ((this._keyUsages & X509KeyUsageFlags.NonRepudiation) != X509KeyUsageFlags.None)
|
||||
{
|
||||
if (stringBuilder.Length > 0)
|
||||
{
|
||||
stringBuilder.Append(", ");
|
||||
}
|
||||
stringBuilder.Append("Non-Repudiation");
|
||||
}
|
||||
if ((this._keyUsages & X509KeyUsageFlags.KeyEncipherment) != X509KeyUsageFlags.None)
|
||||
{
|
||||
if (stringBuilder.Length > 0)
|
||||
{
|
||||
stringBuilder.Append(", ");
|
||||
}
|
||||
stringBuilder.Append("Key Encipherment");
|
||||
}
|
||||
if ((this._keyUsages & X509KeyUsageFlags.DataEncipherment) != X509KeyUsageFlags.None)
|
||||
{
|
||||
if (stringBuilder.Length > 0)
|
||||
{
|
||||
stringBuilder.Append(", ");
|
||||
}
|
||||
stringBuilder.Append("Data Encipherment");
|
||||
}
|
||||
if ((this._keyUsages & X509KeyUsageFlags.KeyAgreement) != X509KeyUsageFlags.None)
|
||||
{
|
||||
if (stringBuilder.Length > 0)
|
||||
{
|
||||
stringBuilder.Append(", ");
|
||||
}
|
||||
stringBuilder.Append("Key Agreement");
|
||||
}
|
||||
if ((this._keyUsages & X509KeyUsageFlags.KeyCertSign) != X509KeyUsageFlags.None)
|
||||
{
|
||||
if (stringBuilder.Length > 0)
|
||||
{
|
||||
stringBuilder.Append(", ");
|
||||
}
|
||||
stringBuilder.Append("Certificate Signing");
|
||||
}
|
||||
if ((this._keyUsages & X509KeyUsageFlags.CrlSign) != X509KeyUsageFlags.None)
|
||||
{
|
||||
if (stringBuilder.Length > 0)
|
||||
{
|
||||
stringBuilder.Append(", ");
|
||||
}
|
||||
stringBuilder.Append("Off-line CRL Signing, CRL Signing");
|
||||
}
|
||||
if ((this._keyUsages & X509KeyUsageFlags.EncipherOnly) != X509KeyUsageFlags.None)
|
||||
{
|
||||
if (stringBuilder.Length > 0)
|
||||
{
|
||||
stringBuilder.Append(", ");
|
||||
}
|
||||
stringBuilder.Append("Encipher Only");
|
||||
}
|
||||
if ((this._keyUsages & X509KeyUsageFlags.DecipherOnly) != X509KeyUsageFlags.None)
|
||||
{
|
||||
if (stringBuilder.Length > 0)
|
||||
{
|
||||
stringBuilder.Append(", ");
|
||||
}
|
||||
stringBuilder.Append("Decipher Only");
|
||||
}
|
||||
int keyUsages = (int)this._keyUsages;
|
||||
stringBuilder.Append(" (");
|
||||
stringBuilder.Append(((byte)keyUsages).ToString("x2"));
|
||||
if (keyUsages > 255)
|
||||
{
|
||||
stringBuilder.Append(" ");
|
||||
stringBuilder.Append(((byte)(keyUsages >> 8)).ToString("x2"));
|
||||
}
|
||||
stringBuilder.Append(")");
|
||||
if (multiLine)
|
||||
{
|
||||
stringBuilder.Append(Environment.NewLine);
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0400135B RID: 4955
|
||||
internal const string oid = "2.5.29.15";
|
||||
|
||||
// Token: 0x0400135C RID: 4956
|
||||
internal const string friendlyName = "Key Usage";
|
||||
|
||||
// Token: 0x0400135D RID: 4957
|
||||
internal const X509KeyUsageFlags all = X509KeyUsageFlags.EncipherOnly | X509KeyUsageFlags.CrlSign | X509KeyUsageFlags.KeyCertSign | X509KeyUsageFlags.KeyAgreement | X509KeyUsageFlags.DataEncipherment | X509KeyUsageFlags.KeyEncipherment | X509KeyUsageFlags.NonRepudiation | X509KeyUsageFlags.DigitalSignature | X509KeyUsageFlags.DecipherOnly;
|
||||
|
||||
// Token: 0x0400135E RID: 4958
|
||||
private X509KeyUsageFlags _keyUsages;
|
||||
|
||||
// Token: 0x0400135F RID: 4959
|
||||
private AsnDecodeStatus _status;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Defines how the certificate key can be used. If this value is not defined, the key can be used for any purpose.</summary>
|
||||
// Token: 0x0200029B RID: 667
|
||||
[Flags]
|
||||
public enum X509KeyUsageFlags
|
||||
{
|
||||
/// <summary>No key usage parameters.</summary>
|
||||
// Token: 0x04001361 RID: 4961
|
||||
None = 0,
|
||||
/// <summary>The key can be used for encryption only.</summary>
|
||||
// Token: 0x04001362 RID: 4962
|
||||
EncipherOnly = 1,
|
||||
/// <summary>The key can be used to sign a certificate revocation list (CRL).</summary>
|
||||
// Token: 0x04001363 RID: 4963
|
||||
CrlSign = 2,
|
||||
/// <summary>The key can be used to sign certificates.</summary>
|
||||
// Token: 0x04001364 RID: 4964
|
||||
KeyCertSign = 4,
|
||||
/// <summary>The key can be used to determine key agreement, such as a key created using the Diffie-Hellman key agreement algorithm.</summary>
|
||||
// Token: 0x04001365 RID: 4965
|
||||
KeyAgreement = 8,
|
||||
/// <summary>The key can be used for data encryption.</summary>
|
||||
// Token: 0x04001366 RID: 4966
|
||||
DataEncipherment = 16,
|
||||
/// <summary>The key can be used for key encryption.</summary>
|
||||
// Token: 0x04001367 RID: 4967
|
||||
KeyEncipherment = 32,
|
||||
/// <summary>The key can be used for authentication.</summary>
|
||||
// Token: 0x04001368 RID: 4968
|
||||
NonRepudiation = 64,
|
||||
/// <summary>The key can be used as a digital signature.</summary>
|
||||
// Token: 0x04001369 RID: 4969
|
||||
DigitalSignature = 128,
|
||||
/// <summary>The key can be used for decryption only.</summary>
|
||||
// Token: 0x0400136A RID: 4970
|
||||
DecipherOnly = 32768
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Specifies the type of name the X509 certificate contains.</summary>
|
||||
// Token: 0x0200029C RID: 668
|
||||
public enum X509NameType
|
||||
{
|
||||
/// <summary>The simple name of a subject or issuer of an X509 certificate.</summary>
|
||||
// Token: 0x0400136C RID: 4972
|
||||
SimpleName,
|
||||
/// <summary>The email address of the subject or issuer associated of an X509 certificate.</summary>
|
||||
// Token: 0x0400136D RID: 4973
|
||||
EmailName,
|
||||
/// <summary>The UPN name of the subject or issuer of an X509 certificate.</summary>
|
||||
// Token: 0x0400136E RID: 4974
|
||||
UpnName,
|
||||
/// <summary>The DNS name associated with the alternative name of either the subject or issuer of an X509 certificate.</summary>
|
||||
// Token: 0x0400136F RID: 4975
|
||||
DnsName,
|
||||
/// <summary>The DNS name associated with the alternative name of either the subject or the issuer of an X.509 certificate. This value is equivalent to the <see cref="F:System.Security.Cryptography.X509Certificates.X509NameType.DnsName" /> value.</summary>
|
||||
// Token: 0x04001370 RID: 4976
|
||||
DnsFromAlternativeName,
|
||||
/// <summary>The URL address associated with the alternative name of either the subject or issuer of an X509 certificate.</summary>
|
||||
// Token: 0x04001371 RID: 4977
|
||||
UrlName
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Specifies which X509 certificates in the chain should be checked for revocation.</summary>
|
||||
// Token: 0x0200029D RID: 669
|
||||
public enum X509RevocationFlag
|
||||
{
|
||||
/// <summary>Only the end certificate is checked for revocation.</summary>
|
||||
// Token: 0x04001373 RID: 4979
|
||||
EndCertificateOnly,
|
||||
/// <summary>The entire chain of certificates is checked for revocation.</summary>
|
||||
// Token: 0x04001374 RID: 4980
|
||||
EntireChain,
|
||||
/// <summary>The entire chain, except the root certificate, is checked for revocation.</summary>
|
||||
// Token: 0x04001375 RID: 4981
|
||||
ExcludeRoot
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Specifies the mode used to check for X509 certificate revocation.</summary>
|
||||
// Token: 0x0200029E RID: 670
|
||||
public enum X509RevocationMode
|
||||
{
|
||||
/// <summary>No revocation check is performed on the certificate.</summary>
|
||||
// Token: 0x04001377 RID: 4983
|
||||
NoCheck,
|
||||
/// <summary>A revocation check is made using an online certificate revocation list (CRL).</summary>
|
||||
// Token: 0x04001378 RID: 4984
|
||||
Online,
|
||||
/// <summary>A revocation check is made using a cached certificate revocation list (CRL).</summary>
|
||||
// Token: 0x04001379 RID: 4985
|
||||
Offline
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,447 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Mono.Security.X509;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Represents an X.509 store, which is a physical store where certificates are persisted and managed. This class cannot be inherited.</summary>
|
||||
// Token: 0x0200029F RID: 671
|
||||
public sealed class X509Store
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Store" /> class using the personal certificates of the current user store.</summary>
|
||||
// Token: 0x06001881 RID: 6273 RVA: 0x0005394C File Offset: 0x00051B4C
|
||||
public X509Store()
|
||||
: this("MY", StoreLocation.CurrentUser)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Store" /> class using the specified store name.</summary>
|
||||
/// <param name="storeName">A string value representing the store name. See <see cref="T:System.Security.Cryptography.X509Certificates.StoreName" /> for more information. </param>
|
||||
// Token: 0x06001882 RID: 6274 RVA: 0x0005395C File Offset: 0x00051B5C
|
||||
public X509Store(string storeName)
|
||||
: this(storeName, StoreLocation.CurrentUser)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Store" /> class using the specified <see cref="T:System.Security.Cryptography.X509Certificates.StoreName" /> value.</summary>
|
||||
/// <param name="storeName">One of the <see cref="T:System.Security.Cryptography.X509Certificates.StoreName" /> values. </param>
|
||||
// Token: 0x06001883 RID: 6275 RVA: 0x00053968 File Offset: 0x00051B68
|
||||
public X509Store(StoreName storeName)
|
||||
: this(storeName, StoreLocation.CurrentUser)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Store" /> class using the specified <see cref="T:System.Security.Cryptography.X509Certificates.StoreLocation" /> value.</summary>
|
||||
/// <param name="storeLocation">One of the <see cref="T:System.Security.Cryptography.X509Certificates.StoreLocation" /> values. </param>
|
||||
// Token: 0x06001884 RID: 6276 RVA: 0x00053974 File Offset: 0x00051B74
|
||||
public X509Store(StoreLocation storeLocation)
|
||||
: this("MY", storeLocation)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Store" /> class using the specified <see cref="T:System.Security.Cryptography.X509Certificates.StoreName" /> and <see cref="T:System.Security.Cryptography.X509Certificates.StoreLocation" /> values.</summary>
|
||||
/// <param name="storeName">One of the <see cref="T:System.Security.Cryptography.X509Certificates.StoreName" /> values. </param>
|
||||
/// <param name="storeLocation">One of the <see cref="T:System.Security.Cryptography.X509Certificates.StoreLocation" /> values. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="storeLocation" /> is not a valid location or <paramref name="storeName" /> is not a valid name. </exception>
|
||||
// Token: 0x06001885 RID: 6277 RVA: 0x00053984 File Offset: 0x00051B84
|
||||
public X509Store(StoreName storeName, StoreLocation storeLocation)
|
||||
{
|
||||
if (storeName < StoreName.AddressBook || storeName > StoreName.TrustedPublisher)
|
||||
{
|
||||
throw new ArgumentException("storeName");
|
||||
}
|
||||
if (storeLocation < StoreLocation.CurrentUser || storeLocation > StoreLocation.LocalMachine)
|
||||
{
|
||||
throw new ArgumentException("storeLocation");
|
||||
}
|
||||
if (storeName != StoreName.CertificateAuthority)
|
||||
{
|
||||
this._name = storeName.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
this._name = "CA";
|
||||
}
|
||||
this._location = storeLocation;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Store" /> class using an Intptr handle to an HCERTSTORE store.</summary>
|
||||
/// <param name="storeHandle">An <see cref="T:System.IntPtr" /> handle to an HCERTSTORE store.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="storeHandle" /> parameter is null.</exception>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The <paramref name="storeHandle" /> parameter points to an invalid context.</exception>
|
||||
// Token: 0x06001886 RID: 6278 RVA: 0x00053A04 File Offset: 0x00051C04
|
||||
[global::System.MonoTODO("Mono's stores are fully managed. All handles are invalid.")]
|
||||
public X509Store(IntPtr storeHandle)
|
||||
{
|
||||
if (storeHandle == IntPtr.Zero)
|
||||
{
|
||||
throw new ArgumentNullException("storeHandle");
|
||||
}
|
||||
throw new CryptographicException("Invalid handle.");
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Store" /> class using a string representing a value from the <see cref="T:System.Security.Cryptography.X509Certificates.StoreName" /> enumeration and a value from the <see cref="T:System.Security.Cryptography.X509Certificates.StoreLocation" /> enumeration.</summary>
|
||||
/// <param name="storeName">A string representing a value from the <see cref="T:System.Security.Cryptography.X509Certificates.StoreName" /> enumeration. </param>
|
||||
/// <param name="storeLocation">One of the <see cref="T:System.Security.Cryptography.X509Certificates.StoreLocation" /> values. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="storeLocation" /> contains invalid values. </exception>
|
||||
// Token: 0x06001887 RID: 6279 RVA: 0x00053A34 File Offset: 0x00051C34
|
||||
public X509Store(string storeName, StoreLocation storeLocation)
|
||||
{
|
||||
if (storeLocation < StoreLocation.CurrentUser || storeLocation > StoreLocation.LocalMachine)
|
||||
{
|
||||
throw new ArgumentException("storeLocation");
|
||||
}
|
||||
this._name = storeName;
|
||||
this._location = storeLocation;
|
||||
}
|
||||
|
||||
/// <summary>Returns a collection of certificates located in an X.509 certificate store.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> object.</returns>
|
||||
// Token: 0x170007B2 RID: 1970
|
||||
// (get) Token: 0x06001888 RID: 6280 RVA: 0x00053A64 File Offset: 0x00051C64
|
||||
public X509Certificate2Collection Certificates
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.list == null)
|
||||
{
|
||||
this.list = new X509Certificate2Collection();
|
||||
}
|
||||
else if (this.store == null)
|
||||
{
|
||||
this.list.Clear();
|
||||
}
|
||||
return this.list;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the location of the X.509 certificate store.</summary>
|
||||
/// <returns>One of the <see cref="T:System.Security.Cryptography.X509Certificates.StoreLocation" /> values.</returns>
|
||||
// Token: 0x170007B3 RID: 1971
|
||||
// (get) Token: 0x06001889 RID: 6281 RVA: 0x00053AA0 File Offset: 0x00051CA0
|
||||
public StoreLocation Location
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._location;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the name of the X.509 certificate store.</summary>
|
||||
/// <returns>One of the <see cref="T:System.Security.Cryptography.X509Certificates.StoreName" /> values.</returns>
|
||||
// Token: 0x170007B4 RID: 1972
|
||||
// (get) Token: 0x0600188A RID: 6282 RVA: 0x00053AA8 File Offset: 0x00051CA8
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._name;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170007B5 RID: 1973
|
||||
// (get) Token: 0x0600188B RID: 6283 RVA: 0x00053AB0 File Offset: 0x00051CB0
|
||||
private X509Stores Factory
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._location == StoreLocation.CurrentUser)
|
||||
{
|
||||
return X509StoreManager.CurrentUser;
|
||||
}
|
||||
return X509StoreManager.LocalMachine;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170007B6 RID: 1974
|
||||
// (get) Token: 0x0600188C RID: 6284 RVA: 0x00053ACC File Offset: 0x00051CCC
|
||||
private bool IsOpen
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.store != null;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170007B7 RID: 1975
|
||||
// (get) Token: 0x0600188D RID: 6285 RVA: 0x00053ADC File Offset: 0x00051CDC
|
||||
private bool IsReadOnly
|
||||
{
|
||||
get
|
||||
{
|
||||
return Environment.UnityWebSecurityEnabled || (this._flags & OpenFlags.ReadWrite) == OpenFlags.ReadOnly;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170007B8 RID: 1976
|
||||
// (get) Token: 0x0600188E RID: 6286 RVA: 0x00053AF8 File Offset: 0x00051CF8
|
||||
internal X509Store Store
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.store;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets an <see cref="T:System.IntPtr" /> handle to an HCERTSTORE store. </summary>
|
||||
/// <returns>An <see cref="T:System.IntPtr" /> handle to an HCERTSTORE store.</returns>
|
||||
// Token: 0x170007B9 RID: 1977
|
||||
// (get) Token: 0x0600188F RID: 6287 RVA: 0x00053B00 File Offset: 0x00051D00
|
||||
[global::System.MonoTODO("Mono's stores are fully managed. Always returns IntPtr.Zero.")]
|
||||
public IntPtr StoreHandle
|
||||
{
|
||||
get
|
||||
{
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Adds a certificate to an X.509 certificate store.</summary>
|
||||
/// <param name="certificate">An <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> object. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="certificate" /> is null. </exception>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The certificate could not be added to the store.</exception>
|
||||
// Token: 0x06001890 RID: 6288 RVA: 0x00053B08 File Offset: 0x00051D08
|
||||
public void Add(X509Certificate2 certificate)
|
||||
{
|
||||
if (certificate == null)
|
||||
{
|
||||
throw new ArgumentNullException("certificate");
|
||||
}
|
||||
if (!this.IsOpen)
|
||||
{
|
||||
throw new CryptographicException(global::Locale.GetText("Store isn't opened."));
|
||||
}
|
||||
if (this.IsReadOnly)
|
||||
{
|
||||
throw new CryptographicException(global::Locale.GetText("Store is read-only."));
|
||||
}
|
||||
if (!this.Exists(certificate))
|
||||
{
|
||||
try
|
||||
{
|
||||
this.store.Import(new X509Certificate(certificate.RawData));
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.Certificates.Add(certificate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Adds a collection of certificates to an X.509 certificate store.</summary>
|
||||
/// <param name="certificates">An <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection" /> object. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="certificates" /> is null. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
// Token: 0x06001891 RID: 6289 RVA: 0x00053BB0 File Offset: 0x00051DB0
|
||||
[global::System.MonoTODO("Method isn't transactional (like documented)")]
|
||||
public void AddRange(X509Certificate2Collection certificates)
|
||||
{
|
||||
if (certificates == null)
|
||||
{
|
||||
throw new ArgumentNullException("certificates");
|
||||
}
|
||||
if (certificates.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!this.IsOpen)
|
||||
{
|
||||
throw new CryptographicException(global::Locale.GetText("Store isn't opened."));
|
||||
}
|
||||
if (this.IsReadOnly)
|
||||
{
|
||||
throw new CryptographicException(global::Locale.GetText("Store is read-only."));
|
||||
}
|
||||
foreach (X509Certificate2 x509Certificate in certificates)
|
||||
{
|
||||
if (!this.Exists(x509Certificate))
|
||||
{
|
||||
try
|
||||
{
|
||||
this.store.Import(new X509Certificate(x509Certificate.RawData));
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.Certificates.Add(x509Certificate);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Closes an X.509 certificate store.</summary>
|
||||
// Token: 0x06001892 RID: 6290 RVA: 0x00053C80 File Offset: 0x00051E80
|
||||
public void Close()
|
||||
{
|
||||
this.store = null;
|
||||
if (this.list != null)
|
||||
{
|
||||
this.list.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Opens an X.509 certificate store or creates a new store, depending on <see cref="T:System.Security.Cryptography.X509Certificates.OpenFlags" /> flag settings.</summary>
|
||||
/// <param name="flags">One the <see cref="T:System.Security.Cryptography.X509Certificates.OpenFlags" /> values. </param>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The store is unreadable. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">The store contains invalid values.</exception>
|
||||
// Token: 0x06001893 RID: 6291 RVA: 0x00053CA0 File Offset: 0x00051EA0
|
||||
public void Open(OpenFlags flags)
|
||||
{
|
||||
if (string.IsNullOrEmpty(this._name))
|
||||
{
|
||||
throw new CryptographicException(global::Locale.GetText("Invalid store name (null or empty)."));
|
||||
}
|
||||
string name = this._name;
|
||||
string text;
|
||||
if (name != null)
|
||||
{
|
||||
if (X509Store.<>f__switch$mapF == null)
|
||||
{
|
||||
X509Store.<>f__switch$mapF = new Dictionary<string, int>(1) { { "Root", 0 } };
|
||||
}
|
||||
int num;
|
||||
if (X509Store.<>f__switch$mapF.TryGetValue(name, out num))
|
||||
{
|
||||
if (num == 0)
|
||||
{
|
||||
text = "Trust";
|
||||
goto IL_8B;
|
||||
}
|
||||
}
|
||||
}
|
||||
text = this._name;
|
||||
IL_8B:
|
||||
bool flag = (flags & OpenFlags.OpenExistingOnly) != OpenFlags.OpenExistingOnly;
|
||||
this.store = this.Factory.Open(text, flag);
|
||||
if (this.store == null)
|
||||
{
|
||||
throw new CryptographicException(global::Locale.GetText("Store {0} doesn't exists.", new object[] { this._name }));
|
||||
}
|
||||
this._flags = flags;
|
||||
foreach (X509Certificate x509Certificate in this.store.Certificates)
|
||||
{
|
||||
this.Certificates.Add(new X509Certificate2(x509Certificate.RawData));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Removes a certificate from an X.509 certificate store.</summary>
|
||||
/// <param name="certificate">The certificate to remove.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="certificate" /> is null. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
// Token: 0x06001894 RID: 6292 RVA: 0x00053DFC File Offset: 0x00051FFC
|
||||
public void Remove(X509Certificate2 certificate)
|
||||
{
|
||||
if (certificate == null)
|
||||
{
|
||||
throw new ArgumentNullException("certificate");
|
||||
}
|
||||
if (!this.IsOpen)
|
||||
{
|
||||
throw new CryptographicException(global::Locale.GetText("Store isn't opened."));
|
||||
}
|
||||
if (!this.Exists(certificate))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (this.IsReadOnly)
|
||||
{
|
||||
throw new CryptographicException(global::Locale.GetText("Store is read-only."));
|
||||
}
|
||||
try
|
||||
{
|
||||
this.store.Remove(new X509Certificate(certificate.RawData));
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.Certificates.Remove(certificate);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Removes a range of certificates from an X.509 certificate store.</summary>
|
||||
/// <param name="certificates">A range of certificates to remove.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="certificates" /> is null. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
// Token: 0x06001895 RID: 6293 RVA: 0x00053EA4 File Offset: 0x000520A4
|
||||
[global::System.MonoTODO("Method isn't transactional (like documented)")]
|
||||
public void RemoveRange(X509Certificate2Collection certificates)
|
||||
{
|
||||
if (certificates == null)
|
||||
{
|
||||
throw new ArgumentNullException("certificates");
|
||||
}
|
||||
if (certificates.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!this.IsOpen)
|
||||
{
|
||||
throw new CryptographicException(global::Locale.GetText("Store isn't opened."));
|
||||
}
|
||||
bool flag = false;
|
||||
foreach (X509Certificate2 x509Certificate in certificates)
|
||||
{
|
||||
if (this.Exists(x509Certificate))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
if (!flag)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (this.IsReadOnly)
|
||||
{
|
||||
throw new CryptographicException(global::Locale.GetText("Store is read-only."));
|
||||
}
|
||||
try
|
||||
{
|
||||
foreach (X509Certificate2 x509Certificate2 in certificates)
|
||||
{
|
||||
this.store.Remove(new X509Certificate(x509Certificate2.RawData));
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.Certificates.RemoveRange(certificates);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001896 RID: 6294 RVA: 0x00053FA0 File Offset: 0x000521A0
|
||||
private bool Exists(X509Certificate2 certificate)
|
||||
{
|
||||
if (this.store == null || this.list == null || certificate == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
foreach (X509Certificate2 x509Certificate in this.list)
|
||||
{
|
||||
if (certificate.Equals(x509Certificate))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Token: 0x0400137A RID: 4986
|
||||
private string _name;
|
||||
|
||||
// Token: 0x0400137B RID: 4987
|
||||
private StoreLocation _location;
|
||||
|
||||
// Token: 0x0400137C RID: 4988
|
||||
private X509Certificate2Collection list;
|
||||
|
||||
// Token: 0x0400137D RID: 4989
|
||||
private OpenFlags _flags;
|
||||
|
||||
// Token: 0x0400137E RID: 4990
|
||||
private X509Store store;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,311 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using Mono.Security;
|
||||
using Mono.Security.Cryptography;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Defines a string that identifies a certificate's subject key identifier (SKI). This class cannot be inherited.</summary>
|
||||
// Token: 0x020002A0 RID: 672
|
||||
public sealed class X509SubjectKeyIdentifierExtension : X509Extension
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509SubjectKeyIdentifierExtension" /> class.</summary>
|
||||
// Token: 0x06001897 RID: 6295 RVA: 0x00054000 File Offset: 0x00052200
|
||||
public X509SubjectKeyIdentifierExtension()
|
||||
{
|
||||
this._oid = new Oid("2.5.29.14", "Subject Key Identifier");
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509SubjectKeyIdentifierExtension" /> class using encoded data and a value that identifies whether the extension is critical.</summary>
|
||||
/// <param name="encodedSubjectKeyIdentifier">The <see cref="T:System.Security.Cryptography.AsnEncodedData" /> object to use to create the extension.</param>
|
||||
/// <param name="critical">true if the extension is critical; otherwise, false.</param>
|
||||
// Token: 0x06001898 RID: 6296 RVA: 0x00054020 File Offset: 0x00052220
|
||||
public X509SubjectKeyIdentifierExtension(AsnEncodedData encodedSubjectKeyIdentifier, bool critical)
|
||||
{
|
||||
this._oid = new Oid("2.5.29.14", "Subject Key Identifier");
|
||||
this._raw = encodedSubjectKeyIdentifier.RawData;
|
||||
base.Critical = critical;
|
||||
this._status = this.Decode(base.RawData);
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509SubjectKeyIdentifierExtension" /> class using a byte array and a value that identifies whether the extension is critical.</summary>
|
||||
/// <param name="subjectKeyIdentifier">A byte array that represents data to use to create the extension.</param>
|
||||
/// <param name="critical">true if the extension is critical; otherwise, false.</param>
|
||||
// Token: 0x06001899 RID: 6297 RVA: 0x00054070 File Offset: 0x00052270
|
||||
public X509SubjectKeyIdentifierExtension(byte[] subjectKeyIdentifier, bool critical)
|
||||
{
|
||||
if (subjectKeyIdentifier == null)
|
||||
{
|
||||
throw new ArgumentNullException("subjectKeyIdentifier");
|
||||
}
|
||||
if (subjectKeyIdentifier.Length == 0)
|
||||
{
|
||||
throw new ArgumentException("subjectKeyIdentifier");
|
||||
}
|
||||
this._oid = new Oid("2.5.29.14", "Subject Key Identifier");
|
||||
base.Critical = critical;
|
||||
this._subjectKeyIdentifier = (byte[])subjectKeyIdentifier.Clone();
|
||||
base.RawData = this.Encode();
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509SubjectKeyIdentifierExtension" /> class using a string and a value that identifies whether the extension is critical.</summary>
|
||||
/// <param name="subjectKeyIdentifier">A string, encoded in hexadecimal format, that represents the subject key identifier (SKI) for a certificate.</param>
|
||||
/// <param name="critical">true if the extension is critical; otherwise, false.</param>
|
||||
// Token: 0x0600189A RID: 6298 RVA: 0x000540E0 File Offset: 0x000522E0
|
||||
public X509SubjectKeyIdentifierExtension(string subjectKeyIdentifier, bool critical)
|
||||
{
|
||||
if (subjectKeyIdentifier == null)
|
||||
{
|
||||
throw new ArgumentNullException("subjectKeyIdentifier");
|
||||
}
|
||||
if (subjectKeyIdentifier.Length < 2)
|
||||
{
|
||||
throw new ArgumentException("subjectKeyIdentifier");
|
||||
}
|
||||
this._oid = new Oid("2.5.29.14", "Subject Key Identifier");
|
||||
base.Critical = critical;
|
||||
this._subjectKeyIdentifier = X509SubjectKeyIdentifierExtension.FromHex(subjectKeyIdentifier);
|
||||
base.RawData = this.Encode();
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509SubjectKeyIdentifierExtension" /> class using a public key and a value indicating whether the extension is critical.</summary>
|
||||
/// <param name="key">A <see cref="T:System.Security.Cryptography.X509Certificates.PublicKey" /> object to create a subject key identifier (SKI) from. </param>
|
||||
/// <param name="critical">true if the extension is critical; otherwise, false.</param>
|
||||
// Token: 0x0600189B RID: 6299 RVA: 0x00054150 File Offset: 0x00052350
|
||||
public X509SubjectKeyIdentifierExtension(PublicKey key, bool critical)
|
||||
: this(key, X509SubjectKeyIdentifierHashAlgorithm.Sha1, critical)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509SubjectKeyIdentifierExtension" /> class using a public key, a hash algorithm identifier, and a value indicating whether the extension is critical. </summary>
|
||||
/// <param name="key">A <see cref="T:System.Security.Cryptography.X509Certificates.PublicKey" /> object to create a subject key identifier (SKI) from.</param>
|
||||
/// <param name="algorithm">One of the <see cref="T:System.Security.Cryptography.X509Certificates.X509SubjectKeyIdentifierHashAlgorithm" /> values that identifies which hash algorithm to use.</param>
|
||||
/// <param name="critical">true if the extension is critical; otherwise, false.</param>
|
||||
// Token: 0x0600189C RID: 6300 RVA: 0x0005415C File Offset: 0x0005235C
|
||||
public X509SubjectKeyIdentifierExtension(PublicKey key, X509SubjectKeyIdentifierHashAlgorithm algorithm, bool critical)
|
||||
{
|
||||
if (key == null)
|
||||
{
|
||||
throw new ArgumentNullException("key");
|
||||
}
|
||||
byte[] rawData = key.EncodedKeyValue.RawData;
|
||||
switch (algorithm)
|
||||
{
|
||||
case X509SubjectKeyIdentifierHashAlgorithm.Sha1:
|
||||
this._subjectKeyIdentifier = SHA1.Create().ComputeHash(rawData);
|
||||
break;
|
||||
case X509SubjectKeyIdentifierHashAlgorithm.ShortSha1:
|
||||
{
|
||||
byte[] array = SHA1.Create().ComputeHash(rawData);
|
||||
this._subjectKeyIdentifier = new byte[8];
|
||||
Buffer.BlockCopy(array, 12, this._subjectKeyIdentifier, 0, 8);
|
||||
this._subjectKeyIdentifier[0] = 64 | (this._subjectKeyIdentifier[0] & 15);
|
||||
break;
|
||||
}
|
||||
case X509SubjectKeyIdentifierHashAlgorithm.CapiSha1:
|
||||
{
|
||||
ASN1 asn = new ASN1(48);
|
||||
ASN1 asn2 = asn.Add(new ASN1(48));
|
||||
asn2.Add(new ASN1(CryptoConfig.EncodeOID(key.Oid.Value)));
|
||||
asn2.Add(new ASN1(key.EncodedParameters.RawData));
|
||||
byte[] array2 = new byte[rawData.Length + 1];
|
||||
Buffer.BlockCopy(rawData, 0, array2, 1, rawData.Length);
|
||||
asn.Add(new ASN1(3, array2));
|
||||
this._subjectKeyIdentifier = SHA1.Create().ComputeHash(asn.GetBytes());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new ArgumentException("algorithm");
|
||||
}
|
||||
this._oid = new Oid("2.5.29.14", "Subject Key Identifier");
|
||||
base.Critical = critical;
|
||||
base.RawData = this.Encode();
|
||||
}
|
||||
|
||||
/// <summary>Gets a string that represents the subject key identifier (SKI) for a certificate.</summary>
|
||||
/// <returns>A string, encoded in hexadecimal format, that represents the subject key identifier (SKI).</returns>
|
||||
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The extension cannot be decoded. </exception>
|
||||
// Token: 0x170007BA RID: 1978
|
||||
// (get) Token: 0x0600189D RID: 6301 RVA: 0x000542C0 File Offset: 0x000524C0
|
||||
public string SubjectKeyIdentifier
|
||||
{
|
||||
get
|
||||
{
|
||||
AsnDecodeStatus status = this._status;
|
||||
if (status != AsnDecodeStatus.Ok && status != AsnDecodeStatus.InformationNotAvailable)
|
||||
{
|
||||
throw new CryptographicException("Badly encoded extension.");
|
||||
}
|
||||
if (this._subjectKeyIdentifier != null)
|
||||
{
|
||||
this._ski = CryptoConvert.ToHex(this._subjectKeyIdentifier);
|
||||
}
|
||||
return this._ski;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Creates a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509SubjectKeyIdentifierExtension" /> class by copying information from encoded data.</summary>
|
||||
/// <param name="asnEncodedData">The <see cref="T:System.Security.Cryptography.AsnEncodedData" /> object to use to create the extension.</param>
|
||||
// Token: 0x0600189E RID: 6302 RVA: 0x00054314 File Offset: 0x00052514
|
||||
public override void CopyFrom(AsnEncodedData encodedData)
|
||||
{
|
||||
if (encodedData == null)
|
||||
{
|
||||
throw new ArgumentNullException("encodedData");
|
||||
}
|
||||
X509Extension x509Extension = encodedData as X509Extension;
|
||||
if (x509Extension == null)
|
||||
{
|
||||
throw new ArgumentException(global::Locale.GetText("Wrong type."), "encodedData");
|
||||
}
|
||||
if (x509Extension._oid == null)
|
||||
{
|
||||
this._oid = new Oid("2.5.29.14", "Subject Key Identifier");
|
||||
}
|
||||
else
|
||||
{
|
||||
this._oid = new Oid(x509Extension._oid);
|
||||
}
|
||||
base.RawData = x509Extension.RawData;
|
||||
base.Critical = x509Extension.Critical;
|
||||
this._status = this.Decode(base.RawData);
|
||||
}
|
||||
|
||||
// Token: 0x0600189F RID: 6303 RVA: 0x000543B4 File Offset: 0x000525B4
|
||||
internal static byte FromHexChar(char c)
|
||||
{
|
||||
if (c >= 'a' && c <= 'f')
|
||||
{
|
||||
return (byte)(c - 'a' + '\n');
|
||||
}
|
||||
if (c >= 'A' && c <= 'F')
|
||||
{
|
||||
return (byte)(c - 'A' + '\n');
|
||||
}
|
||||
if (c >= '0' && c <= '9')
|
||||
{
|
||||
return (byte)(c - '0');
|
||||
}
|
||||
return byte.MaxValue;
|
||||
}
|
||||
|
||||
// Token: 0x060018A0 RID: 6304 RVA: 0x00054410 File Offset: 0x00052610
|
||||
internal static byte FromHexChars(char c1, char c2)
|
||||
{
|
||||
byte b = X509SubjectKeyIdentifierExtension.FromHexChar(c1);
|
||||
if (b < 255)
|
||||
{
|
||||
b = (byte)(((int)b << 4) | (int)X509SubjectKeyIdentifierExtension.FromHexChar(c2));
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
// Token: 0x060018A1 RID: 6305 RVA: 0x0005443C File Offset: 0x0005263C
|
||||
internal static byte[] FromHex(string hex)
|
||||
{
|
||||
if (hex == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
int num = hex.Length >> 1;
|
||||
byte[] array = new byte[num];
|
||||
int i = 0;
|
||||
int num2 = 0;
|
||||
while (i < num)
|
||||
{
|
||||
array[i++] = X509SubjectKeyIdentifierExtension.FromHexChars(hex[num2++], hex[num2++]);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x060018A2 RID: 6306 RVA: 0x00054494 File Offset: 0x00052694
|
||||
internal AsnDecodeStatus Decode(byte[] extension)
|
||||
{
|
||||
if (extension == null || extension.Length == 0)
|
||||
{
|
||||
return AsnDecodeStatus.BadAsn;
|
||||
}
|
||||
this._ski = string.Empty;
|
||||
if (extension[0] != 4)
|
||||
{
|
||||
return AsnDecodeStatus.BadTag;
|
||||
}
|
||||
if (extension.Length == 2)
|
||||
{
|
||||
return AsnDecodeStatus.InformationNotAvailable;
|
||||
}
|
||||
if (extension.Length < 3)
|
||||
{
|
||||
return AsnDecodeStatus.BadLength;
|
||||
}
|
||||
try
|
||||
{
|
||||
ASN1 asn = new ASN1(extension);
|
||||
this._subjectKeyIdentifier = asn.Value;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return AsnDecodeStatus.BadAsn;
|
||||
}
|
||||
return AsnDecodeStatus.Ok;
|
||||
}
|
||||
|
||||
// Token: 0x060018A3 RID: 6307 RVA: 0x00054524 File Offset: 0x00052724
|
||||
internal byte[] Encode()
|
||||
{
|
||||
ASN1 asn = new ASN1(4, this._subjectKeyIdentifier);
|
||||
return asn.GetBytes();
|
||||
}
|
||||
|
||||
// Token: 0x060018A4 RID: 6308 RVA: 0x00054544 File Offset: 0x00052744
|
||||
internal override string ToString(bool multiLine)
|
||||
{
|
||||
switch (this._status)
|
||||
{
|
||||
case AsnDecodeStatus.BadAsn:
|
||||
return string.Empty;
|
||||
case AsnDecodeStatus.BadTag:
|
||||
case AsnDecodeStatus.BadLength:
|
||||
return base.FormatUnkownData(this._raw);
|
||||
case AsnDecodeStatus.InformationNotAvailable:
|
||||
return "Information Not Available";
|
||||
default:
|
||||
{
|
||||
if (this._oid.Value != "2.5.29.14")
|
||||
{
|
||||
return string.Format("Unknown Key Usage ({0})", this._oid.Value);
|
||||
}
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (int i = 0; i < this._subjectKeyIdentifier.Length; i++)
|
||||
{
|
||||
stringBuilder.Append(this._subjectKeyIdentifier[i].ToString("x2"));
|
||||
if (i != this._subjectKeyIdentifier.Length - 1)
|
||||
{
|
||||
stringBuilder.Append(" ");
|
||||
}
|
||||
}
|
||||
if (multiLine)
|
||||
{
|
||||
stringBuilder.Append(Environment.NewLine);
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04001380 RID: 4992
|
||||
internal const string oid = "2.5.29.14";
|
||||
|
||||
// Token: 0x04001381 RID: 4993
|
||||
internal const string friendlyName = "Subject Key Identifier";
|
||||
|
||||
// Token: 0x04001382 RID: 4994
|
||||
private byte[] _subjectKeyIdentifier;
|
||||
|
||||
// Token: 0x04001383 RID: 4995
|
||||
private string _ski;
|
||||
|
||||
// Token: 0x04001384 RID: 4996
|
||||
private AsnDecodeStatus _status;
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Defines the type of hash algorithm to use with the <see cref="T:System.Security.Cryptography.X509Certificates.X509SubjectKeyIdentifierExtension" /> class.</summary>
|
||||
// Token: 0x020002A1 RID: 673
|
||||
public enum X509SubjectKeyIdentifierHashAlgorithm
|
||||
{
|
||||
/// <summary>The SKI is composed of the 160-bit SHA-1 hash of the value of the public key (excluding the tag, length, and number of unused bits).</summary>
|
||||
// Token: 0x04001386 RID: 4998
|
||||
Sha1,
|
||||
/// <summary>The SKI is composed of a four-bit type field with the value 0100, followed by the least significant 60 bits of the SHA-1 hash of the value of the public key (excluding the tag, length, and number of unused bit string bits)</summary>
|
||||
// Token: 0x04001387 RID: 4999
|
||||
ShortSha1,
|
||||
/// <summary>The subject key identifier (SKI) is composed of a 160-bit SHA-1 hash of the encoded public key (including the tag, length, and number of unused bits).</summary>
|
||||
// Token: 0x04001388 RID: 5000
|
||||
CapiSha1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
/// <summary>Specifies conditions under which verification of certificates in the X509 chain should be conducted.</summary>
|
||||
// Token: 0x020002A2 RID: 674
|
||||
[Flags]
|
||||
public enum X509VerificationFlags
|
||||
{
|
||||
/// <summary>No flags pertaining to verification are included.</summary>
|
||||
// Token: 0x0400138A RID: 5002
|
||||
NoFlag = 0,
|
||||
/// <summary>Ignore certificates in the chain that are not valid either because they have expired or they are not yet in effect when determining certificate validity.</summary>
|
||||
// Token: 0x0400138B RID: 5003
|
||||
IgnoreNotTimeValid = 1,
|
||||
/// <summary>Ignore that the certificate trust list (CTL) is not valid, for reasons such as the CTL has expired, when determining certificate verification.</summary>
|
||||
// Token: 0x0400138C RID: 5004
|
||||
IgnoreCtlNotTimeValid = 2,
|
||||
/// <summary>Ignore that the CA (certificate authority) certificate and the issued certificate have validity periods that are not nested when verifying the certificate. For example, the CA cert can be valid from January 1 to December 1 and the issued certificate from January 2 to December 2, which would mean the validity periods are not nested.</summary>
|
||||
// Token: 0x0400138D RID: 5005
|
||||
IgnoreNotTimeNested = 4,
|
||||
/// <summary>Ignore that the basic constraints are not valid when determining certificate verification.</summary>
|
||||
// Token: 0x0400138E RID: 5006
|
||||
IgnoreInvalidBasicConstraints = 8,
|
||||
/// <summary>Ignore that the chain cannot be verified due to an unknown certificate authority (CA).</summary>
|
||||
// Token: 0x0400138F RID: 5007
|
||||
AllowUnknownCertificateAuthority = 16,
|
||||
/// <summary>Ignore that the certificate was not issued for the current use when determining certificate verification.</summary>
|
||||
// Token: 0x04001390 RID: 5008
|
||||
IgnoreWrongUsage = 32,
|
||||
/// <summary>Ignore that the certificate has an invalid name when determining certificate verification.</summary>
|
||||
// Token: 0x04001391 RID: 5009
|
||||
IgnoreInvalidName = 64,
|
||||
/// <summary>Ignore that the certificate has invalid policy when determining certificate verification.</summary>
|
||||
// Token: 0x04001392 RID: 5010
|
||||
IgnoreInvalidPolicy = 128,
|
||||
/// <summary>Ignore that the end certificate (the user certificate) revocation is unknown when determining certificate verification.</summary>
|
||||
// Token: 0x04001393 RID: 5011
|
||||
IgnoreEndRevocationUnknown = 256,
|
||||
/// <summary>Ignore that the certificate trust list (CTL) signer revocation is unknown when determining certificate verification.</summary>
|
||||
// Token: 0x04001394 RID: 5012
|
||||
IgnoreCtlSignerRevocationUnknown = 512,
|
||||
/// <summary>Ignore that the certificate authority revocation is unknown when determining certificate verification.</summary>
|
||||
// Token: 0x04001395 RID: 5013
|
||||
IgnoreCertificateAuthorityRevocationUnknown = 1024,
|
||||
/// <summary>Ignore that the root revocation is unknown when determining certificate verification.</summary>
|
||||
// Token: 0x04001396 RID: 5014
|
||||
IgnoreRootRevocationUnknown = 2048,
|
||||
/// <summary>All flags pertaining to verification are included.</summary>
|
||||
// Token: 0x04001397 RID: 5015
|
||||
AllFlags = 4095
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user