КриптоПро .NET
Search Results for

    Показать/Скрыть содержание

    Class CpPublicKey

    Represents the public key of a certificate.

    Inheritance
    object
    CpPublicKey
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: CryptoPro.Security.Cryptography.X509Certificates
    Assembly: CryptoPro.Security.Cryptography.dll
    Syntax
    public sealed class CpPublicKey

    Constructors

    CpPublicKey(AsymmetricAlgorithm)

    Initializes a new instance of the PublicKey class using SubjectPublicKeyInfo from an AsymmetricAlgorithm.

    Declaration
    public CpPublicKey(AsymmetricAlgorithm key)
    Parameters
    Type Name Description
    AsymmetricAlgorithm key

    An asymmetric algorithm to obtain the SubjectPublicKeyInfo from.

    Exceptions
    Type Condition
    CryptographicException

    The SubjectPublicKeyInfo could not be decoded. The ExportSubjectPublicKeyInfo() must return a valid ASN.1-DER encoded X.509 SubjectPublicKeyInfo.

    NotImplementedException

    ExportSubjectPublicKeyInfo() has not been overridden in a derived class.

    CpPublicKey(Oid, CpAsnEncodedData, CpAsnEncodedData)

    Declaration
    public CpPublicKey(Oid oid, CpAsnEncodedData parameters, CpAsnEncodedData keyValue)
    Parameters
    Type Name Description
    Oid oid
    CpAsnEncodedData parameters
    CpAsnEncodedData keyValue

    Properties

    EncodedKeyValue

    Declaration
    public CpAsnEncodedData EncodedKeyValue { get; }
    Property Value
    Type Description
    CpAsnEncodedData

    EncodedParameters

    Declaration
    public CpAsnEncodedData EncodedParameters { get; }
    Property Value
    Type Description
    CpAsnEncodedData

    Key

    Declaration
    public AsymmetricAlgorithm Key { get; }
    Property Value
    Type Description
    AsymmetricAlgorithm

    Oid

    Declaration
    public Oid Oid { get; }
    Property Value
    Type Description
    Oid

    Methods

    CreateFromSubjectPublicKeyInfo(ReadOnlySpan<byte>, out int)

    Creates a new instance of PublicKey from a X.509 SubjectPublicKeyInfo.

    Declaration
    public static CpPublicKey CreateFromSubjectPublicKeyInfo(ReadOnlySpan<byte> source, out int bytesRead)
    Parameters
    Type Name Description
    ReadOnlySpan<byte> source

    The bytes of an X.509 SubjectPublicKeyInfo structure in the ASN.1-DER encoding.

    int bytesRead

    When this method returns, contains a value that indicates the number of bytes read from source. This parameter is treated as uninitialized.

    Returns
    Type Description
    CpPublicKey

    A public key representing the SubjectPublicKeyInfo.

    Exceptions
    Type Condition
    CryptographicException

    The SubjectPublicKeyInfo could not be decoded.

    ExportSubjectPublicKeyInfo()

    Exports the current key in the X.509 SubjectPublicKeyInfo format.

    Declaration
    public byte[] ExportSubjectPublicKeyInfo()
    Returns
    Type Description
    byte[]

    A byte array containing the X.509 SubjectPublicKeyInfo representation of this key.

    GetDSAPublicKey()

    Gets the DSA public key, or null if the key is not an DSA key.

    Declaration
    public DSA? GetDSAPublicKey()
    Returns
    Type Description
    DSA

    The public key, or null if the key is not an DSA key.

    Exceptions
    Type Condition
    CryptographicException

    The key contents are corrupt or could not be read successfully.

    GetECDiffieHellmanPublicKey()

    Gets the ECDiffieHellman public key, or null if the key is not an ECDiffieHellman key.

    Declaration
    public ECDiffieHellman? GetECDiffieHellmanPublicKey()
    Returns
    Type Description
    ECDiffieHellman

    The public key, or null if the key is not an ECDiffieHellman key.

    Exceptions
    Type Condition
    CryptographicException

    The key contents are corrupt or could not be read successfully.

    GetECDsaPublicKey()

    Gets the ECDsa public key, or null if the key is not an ECDsa key.

    Declaration
    public ECDsa? GetECDsaPublicKey()
    Returns
    Type Description
    ECDsa

    The public key, or null if the key is not an ECDsa key.

    Exceptions
    Type Condition
    CryptographicException

    The key contents are corrupt or could not be read successfully.

    GetRSAPublicKey()

    Gets the RSA public key, or null if the key is not an RSA key.

    Declaration
    public CpRSA? GetRSAPublicKey()
    Returns
    Type Description
    CpRSA

    The public key, or null if the key is not an RSA key.

    Exceptions
    Type Condition
    CryptographicException

    The key contents are corrupt or could not be read successfully.

    TryExportSubjectPublicKeyInfo(Span<byte>, out int)

    Attempts to export the current key in the X.509 SubjectPublicKeyInfo format into a provided buffer.

    Declaration
    public bool TryExportSubjectPublicKeyInfo(Span<byte> destination, out int bytesWritten)
    Parameters
    Type Name Description
    Span<byte> destination

    The byte span to receive the X.509 SubjectPublicKeyInfo data.

    int bytesWritten

    When this method returns, contains a value that indicates the number of bytes written to destination. This parameter is treated as uninitialized.

    Returns
    Type Description
    bool

    true if destination is big enough to receive the output; otherwise, false.

    В этом разделе
    Наверх Generated by DocFX