Compartilhar via


X509Certificate.Import Method (array<Byte[], String, X509KeyStorageFlags)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Populates the X509Certificate object using data from a byte array, a password, and flags for determining how the private key is imported.

Namespace:  System.Security.Cryptography.X509Certificates
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
<SecuritySafeCriticalAttribute> _
<ComVisibleAttribute(False)> _
Public Overridable Sub Import ( _
    rawData As Byte(), _
    password As String, _
    keyStorageFlags As X509KeyStorageFlags _
)
[SecuritySafeCriticalAttribute]
[ComVisibleAttribute(false)]
public virtual void Import(
    byte[] rawData,
    string password,
    X509KeyStorageFlags keyStorageFlags
)

Parameters

  • rawData
    Type: array<System.Byte[]
    A byte array containing data from an X.509 certificate.
  • password
    Type: System.String
    The password required to access the X.509 certificate data.

Exceptions

Exception Condition
ArgumentException

The rawData parameter is nulla null reference (Nothing in Visual Basic).

-or-

The length of the rawData parameter is 0.

Remarks

This method can be used to populate an X509Certificate object using a password for the certificate represented by the byte array. The X509KeyStorageFlags value can be used to control where and how the private key is imported.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.