Class X509CertificateIdentityDefinitionBase
Provides a base class for X.509 certificate based identities.
Inheritance
Inherited Members
Namespace: Nevatech.Vsb.Repository.Services.Identities
Assembly: Nevatech.Vsb.Repository.dll
Syntax
[DataContract(Namespace = "http://schemas.nevatech.com/sentinet/2011/02")]
public abstract class X509CertificateIdentityDefinitionBase : IdentityDefinitionBase, IValidator, IExtensibleDataObject, IX509CertificateIdentity
Constructors
X509CertificateIdentityDefinitionBase()
Initializes an empty instance.
Declaration
protected X509CertificateIdentityDefinitionBase()
X509CertificateIdentityDefinitionBase(Identity)
Initializes new instance from provided Identity object.
Declaration
protected X509CertificateIdentityDefinitionBase(Identity identity)
Parameters
| Type | Name | Description |
|---|---|---|
| Identity | identity | Identity object used to populate new instance. |
X509CertificateIdentityDefinitionBase(byte[])
Initializes new instance from provided certificate's raw bytes.
Declaration
protected X509CertificateIdentityDefinitionBase(byte[] data)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | data | Byte array containing serialized X.509 certificate. |
X509CertificateIdentityDefinitionBase(X509Certificate2, bool)
Initializes new instance from provided X.509 certificate.
Declaration
protected X509CertificateIdentityDefinitionBase(X509Certificate2 certificate, bool storePrivateKey)
Parameters
| Type | Name | Description |
|---|---|---|
| X509Certificate2 | certificate | X.509 certificate used to initialize new instance. |
| bool | storePrivateKey | Flag indicating that private key must be exported to RawData property. |
Properties
FriendlyName
Gets or sets the friendly name describing stored identity.
Declaration
[DataMember]
public override sealed string FriendlyName { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Overrides
RawData
Gets the byte array containing serialized X.509 certificate.
Declaration
[DataMember]
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public byte[] RawData { get; protected set; }
Property Value
| Type | Description |
|---|---|
| byte[] |
Thumbprint
Gets the certificate's thumbprint value as Base64-encoded string.
Declaration
[DataMember]
public string Thumbprint { get; protected set; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
GetCertificate(bool)
Returns X.509 certificate represented by this identity.
Declaration
[SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
public X509Certificate2 GetCertificate(bool mustHavePrivateKey)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | mustHavePrivateKey | Flag indicating that returned X.509 certificate must have a private key. If key does not exists or is not accessible than exception will be thrown. |
Returns
| Type | Description |
|---|---|
| X509Certificate2 | X.509 certificate represented by this identity. |
GetIdentity()
Returns Identity object populated with the data stored in this instance.
Declaration
public override Identity GetIdentity()
Returns
| Type | Description |
|---|---|
| Identity | Identity object populated with the data stored in this instance. |
Overrides
InitializeFromCertificate(X509Certificate2, bool)
Populates instance properties from the provided certificate.
Declaration
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
[SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
protected void InitializeFromCertificate(X509Certificate2 certificate = null, bool storePrivateKey = false)
Parameters
| Type | Name | Description |
|---|---|---|
| X509Certificate2 | certificate | X.509 certificate to be initialized from. If certificate is NULL then it will be loaded from the RawData property. |
| bool | storePrivateKey | Flag indicating that private key must be exported to the serialized
certificate's bytes. This flag is only applied if parameter
|
Validate()
Validates this domain object's state.
Declaration
public override bool Validate()
Returns
| Type | Description |
|---|---|
| bool | True if object's state is valid; otherwise, false. |