ECAlgorithm.ImportEncryptedPkcs8PrivateKey Metoda

Definicja

Przeciążenia

ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Int32)

Importuje publiczny/prywatny kluczpair z struktury PKCS#8 EncryptedPrivateKeyInfo po odszyfrowaniu przy użyciu hasła opartego na bajtach, zastępując klucze dla tego obiektu.

ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, ReadOnlySpan<Byte>, Int32)

Importuje publiczny/prywatny kluczpair z struktury PKCS#8 EncryptedPrivateKeyInfo po odszyfrowaniu przy użyciu hasła opartego na bajtach, zastępując klucze dla tego obiektu.

ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Int32)

Importuje publiczny/prywatny kluczpair z struktury PKCS#8 EncryptedPrivateKeyInfo po odszyfrowaniu przy użyciu hasła opartego na bajtach, zastępując klucze dla tego obiektu.

public:
 override void ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<System::Byte> passwordBytes, ReadOnlySpan<System::Byte> source, [Runtime::InteropServices::Out] int % bytesRead);
public override void ImportEncryptedPkcs8PrivateKey (ReadOnlySpan<byte> passwordBytes, ReadOnlySpan<byte> source, out int bytesRead);
override this.ImportEncryptedPkcs8PrivateKey : ReadOnlySpan<byte> * ReadOnlySpan<byte> * int -> unit
Public Overrides Sub ImportEncryptedPkcs8PrivateKey (passwordBytes As ReadOnlySpan(Of Byte), source As ReadOnlySpan(Of Byte), ByRef bytesRead As Integer)

Parametry

passwordBytes
ReadOnlySpan<Byte>

Bajty do użycia jako hasło podczas odszyfrowywania materiału klucza.

source
ReadOnlySpan<Byte>

Bajty struktury PKCS#8 EncryptedPrivateKeyInfo w kodowaniu ASN.1-BER.

bytesRead
Int32

Gdy ta metoda zwraca wartość, zawiera wartość wskazującą liczbę bajtów odczytanych z sourceelementu . Ten parametr jest traktowany jako niezainicjowany.

Wyjątki

Hasło jest niepoprawne.

-lub-

Zawartość source wskazuje, że funkcja wyprowadzania klucza (KDF) ma zastosowanie, to starsza wersja PKCS#12 KDF, która wymaga charhaseł opartych na hasłach.

-lub-

Zawartość elementu source nie reprezentuje struktury PKCS#8 EncryptedPrivateKeyInfo zakodowanej w formacie ASN.1.1.

-lub-

Zawartość source wskazuje, że klucz jest dla algorytmu innego niż algorytm reprezentowany przez to wystąpienie.

-lub-

Zawartość source klucza reprezentuje klucz w formacie, który nie jest obsługiwany.

-lub-

Importowanie klucza specyficznego dla algorytmu nie powiodło się.

Klasa pochodna nie dostarczyła implementacji dla ImportParameters(ECParameters)klasy .

Uwagi

The password bytes are passed directly into the Key Derivation Function (KDF) used by the algorithm indicated by the EncryptedPrivateKeyInfo contents. This enables compatibility with other systems which use a text encoding other than UTF-8 when processing passwords with PBKDF2 (Password-Based Key Derivation Function 2).

          This method only supports the binary (BER/CER/DER) encoding of EncryptedPrivateKeyInfo.
          If the value is Base64-encoded, the caller must Base64-decode the contents before calling this method.
          If the contents are PEM-encoded, <xref:System.Security.Cryptography.ECAlgorithm.ImportFromEncryptedPem(System.ReadOnlySpan{System.Char},System.ReadOnlySpan{System.Byte})>
          should be used.

Dotyczy

ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, ReadOnlySpan<Byte>, Int32)

Importuje publiczny/prywatny kluczpair z struktury PKCS#8 EncryptedPrivateKeyInfo po odszyfrowaniu przy użyciu hasła opartego na bajtach, zastępując klucze dla tego obiektu.

public:
 override void ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<char> password, ReadOnlySpan<System::Byte> source, [Runtime::InteropServices::Out] int % bytesRead);
public override void ImportEncryptedPkcs8PrivateKey (ReadOnlySpan<char> password, ReadOnlySpan<byte> source, out int bytesRead);
override this.ImportEncryptedPkcs8PrivateKey : ReadOnlySpan<char> * ReadOnlySpan<byte> * int -> unit
Public Overrides Sub ImportEncryptedPkcs8PrivateKey (password As ReadOnlySpan(Of Char), source As ReadOnlySpan(Of Byte), ByRef bytesRead As Integer)

Parametry

password
ReadOnlySpan<Char>

Hasło do użycia podczas odszyfrowywania materiału klucza.

source
ReadOnlySpan<Byte>

Bajty struktury PKCS#8 EncryptedPrivateKeyInfo w kodowaniu ASN.1-BER.

bytesRead
Int32

Gdy ta metoda zwraca wartość, zawiera wartość wskazującą liczbę bajtów odczytanych z sourceelementu . Ten parametr jest traktowany jako niezainicjowany.

Wyjątki

Zawartość elementu source nie reprezentuje struktury PKCS#8 EncryptedPrivateKeyInfo zakodowanej w formacie ASN.1.1.

-lub-

Zawartość source wskazuje, że klucz jest dla algorytmu innego niż algorytm reprezentowany przez to wystąpienie.

-lub-

Zawartość source klucza reprezentuje klucz w formacie, który nie jest obsługiwany.

-lub-

Importowanie klucza specyficznego dla algorytmu nie powiodło się.

Klasa pochodna nie dostarczyła implementacji dla ImportParameters(ECParameters)klasy .

Uwagi

When the contents of source indicate an algorithm that uses PBKDF1 (Password-Based Key Derivation Function 1) or PBKDF2 (Password-Based Key Derivation Function 2), the password is converted to bytes via the UTF-8 encoding.

          This method only supports the binary (BER/CER/DER) encoding of EncryptedPrivateKeyInfo.
          If the value is Base64-encoded, the caller must Base64-decode the contents before calling this method.
          If the contents are PEM-encoded, <xref:System.Security.Cryptography.ECAlgorithm.ImportFromEncryptedPem(System.ReadOnlySpan{System.Char},System.ReadOnlySpan{System.Char})>
          should be used.

Dotyczy