internal SubjectIdentifierOrKey(SubjectIdentifierOrKeyType type, object value) { Debug.Assert(value != null); #if DEBUG switch (type) { case SubjectIdentifierOrKeyType.IssuerAndSerialNumber: Debug.Assert(value is X509IssuerSerial); break; case SubjectIdentifierOrKeyType.SubjectKeyIdentifier: Debug.Assert(value is string); break; case SubjectIdentifierOrKeyType.PublicKeyInfo: Debug.Assert(value is PublicKeyInfo); break; default: Debug.Fail($"Illegal type passed to SubjectIdentifierOrKey: {type}"); break; } #endif Type = type; Value = value; }
internal void Reset(SubjectIdentifierOrKeyType type, object value) { switch (type) { case SubjectIdentifierOrKeyType.Unknown: this.m_type = type; this.m_value = value; break; case SubjectIdentifierOrKeyType.IssuerAndSerialNumber: if (value.GetType() != typeof(X509IssuerSerial)) { throw new CryptographicException(SecurityResources.GetResourceString("Cryptography_Cms_Invalid_Subject_Identifier_Type_Value_Mismatch"), value.GetType().ToString()); } else { goto case 0; } case SubjectIdentifierOrKeyType.SubjectKeyIdentifier: if (!PkcsUtils.CmsSupported()) { throw new CryptographicException(SecurityResources.GetResourceString("Cryptography_Cms_Not_Supported")); } if (value.GetType() != typeof(string)) { throw new CryptographicException(SecurityResources.GetResourceString("Cryptography_Cms_Invalid_Subject_Identifier_Type_Value_Mismatch"), value.GetType().ToString()); } else { goto case 0; } case SubjectIdentifierOrKeyType.PublicKeyInfo: if (!PkcsUtils.CmsSupported()) { throw new CryptographicException(SecurityResources.GetResourceString("Cryptography_Cms_Not_Supported")); } if (value.GetType() != typeof(PublicKeyInfo)) { throw new CryptographicException(SecurityResources.GetResourceString("Cryptography_Cms_Invalid_Subject_Identifier_Type_Value_Mismatch"), value.GetType().ToString()); } else { goto case 0; } default: throw new CryptographicException(SecurityResources.GetResourceString("Cryptography_Cms_Invalid_Subject_Identifier_Type"), ((object)type).ToString()); } }
internal void Reset(SubjectIdentifierOrKeyType type, object value) { switch (type) { case SubjectIdentifierOrKeyType.Unknown: break; case SubjectIdentifierOrKeyType.IssuerAndSerialNumber: if (value.GetType() != typeof(X509IssuerSerial)) { throw new CryptographicException(SecurityResources.GetResourceString("Cryptography_Cms_Invalid_Subject_Identifier_Type_Value_Mismatch"), value.GetType().ToString()); } break; case SubjectIdentifierOrKeyType.SubjectKeyIdentifier: if (!PkcsUtils.CmsSupported()) { throw new CryptographicException(SecurityResources.GetResourceString("Cryptography_Cms_Not_Supported")); } if (!(value.GetType() != typeof(string))) { break; } throw new CryptographicException(SecurityResources.GetResourceString("Cryptography_Cms_Invalid_Subject_Identifier_Type_Value_Mismatch"), value.GetType().ToString()); case SubjectIdentifierOrKeyType.PublicKeyInfo: if (!PkcsUtils.CmsSupported()) { throw new CryptographicException(SecurityResources.GetResourceString("Cryptography_Cms_Not_Supported")); } if (value.GetType() != typeof(PublicKeyInfo)) { throw new CryptographicException(SecurityResources.GetResourceString("Cryptography_Cms_Invalid_Subject_Identifier_Type_Value_Mismatch"), value.GetType().ToString()); } break; default: throw new CryptographicException(SecurityResources.GetResourceString("Cryptography_Cms_Invalid_Subject_Identifier_Type"), type.ToString()); } this.m_type = type; this.m_value = value; }
internal SubjectIdentifierOrKey (SubjectIdentifierOrKeyType type, Object value) { Reset(type, value); }
internal SubjectIdentifierOrKey(SubjectIdentifierOrKeyType type, object value) { _type = type; _value = value; }
internal SubjectIdentifierOrKey(SubjectIdentifierOrKeyType type, Object value) { Reset(type, value); }
internal SubjectIdentifierOrKey(SubjectIdentifierOrKeyType type, object value) { this.Reset(type, value); }
internal SubjectIdentifierOrKey (SubjectIdentifierOrKeyType type, object value) { _type = type; _value = value; }