C# Класс BitSharper.EcKey

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
EcKey ( BigInteger privKey ) : System

Creates an ECKey given only the private key. This works because EC public keys are derivable from their private keys by doing a multiply with the generator value.

FromAsn1 ( byte asn1PrivKey ) : EcKey

Construct an ECKey from an ASN.1 encoded private key. These are produced by OpenSSL and stored by the BitCoin reference implementation in its wallet.

GetPrivKeyBytes ( ) : byte[]

Returns a 32 byte array containing the private key.

GetPrivateKeyEncoded ( NetworkParameters @params ) : DumpedPrivateKey

Exports the private key in the form used by the Satoshi client "dumpprivkey" and "importprivkey" commands. Use the DumpedPrivateKey.ToString method to get the string.

Sign ( byte input ) : byte[]

Calculates an ECDSA signature in DER format for the given input hash. Note that the input is expected to be 32 bytes long.

ToAddress ( NetworkParameters @params ) : Address

Returns the address that corresponds to the public part of this ECKey. Note that an address is derived from the RIPEMD-160 hash of the public key and is not the public key itself (which is too large to be convenient).

ToAsn1 ( ) : byte[]

Output this ECKey as an ASN.1 encoded private key, as understood by OpenSSL or used by the BitCoin reference implementation in its wallet storage format.

ToString ( ) : string
Verify ( byte data, byte signature ) : bool

Verifies the given ASN.1 encoded ECDSA signature against a hash using the public key.

Verify ( byte data, byte signature, byte pub ) : bool

Verifies the given ASN.1 encoded ECDSA signature against a hash using the public key.

Приватные методы

Метод Описание
EcKey ( ) : System
ExtractPrivateKeyFromAsn1 ( byte asn1PrivKey ) : BigInteger
PublicKeyFromPrivate ( BigInteger privKey ) : byte[]

Derive the public key by doing a point multiply of G * priv.

Описание методов

EcKey() публичный Метод

Creates an ECKey given only the private key. This works because EC public keys are derivable from their private keys by doing a multiply with the generator value.
public EcKey ( BigInteger privKey ) : System
privKey Org.BouncyCastle.Math.BigInteger
Результат System

FromAsn1() публичный статический Метод

Construct an ECKey from an ASN.1 encoded private key. These are produced by OpenSSL and stored by the BitCoin reference implementation in its wallet.
public static FromAsn1 ( byte asn1PrivKey ) : EcKey
asn1PrivKey byte
Результат EcKey

GetPrivKeyBytes() публичный Метод

Returns a 32 byte array containing the private key.
public GetPrivKeyBytes ( ) : byte[]
Результат byte[]

GetPrivateKeyEncoded() публичный Метод

Exports the private key in the form used by the Satoshi client "dumpprivkey" and "importprivkey" commands. Use the DumpedPrivateKey.ToString method to get the string.
public GetPrivateKeyEncoded ( NetworkParameters @params ) : DumpedPrivateKey
@params NetworkParameters
Результат DumpedPrivateKey

Sign() публичный Метод

Calculates an ECDSA signature in DER format for the given input hash. Note that the input is expected to be 32 bytes long.
public Sign ( byte input ) : byte[]
input byte
Результат byte[]

ToAddress() публичный Метод

Returns the address that corresponds to the public part of this ECKey. Note that an address is derived from the RIPEMD-160 hash of the public key and is not the public key itself (which is too large to be convenient).
public ToAddress ( NetworkParameters @params ) : Address
@params NetworkParameters
Результат Address

ToAsn1() публичный Метод

Output this ECKey as an ASN.1 encoded private key, as understood by OpenSSL or used by the BitCoin reference implementation in its wallet storage format.
public ToAsn1 ( ) : byte[]
Результат byte[]

ToString() публичный Метод

public ToString ( ) : string
Результат string

Verify() публичный Метод

Verifies the given ASN.1 encoded ECDSA signature against a hash using the public key.
public Verify ( byte data, byte signature ) : bool
data byte Hash of the data to verify.
signature byte ASN.1 encoded signature.
Результат bool

Verify() публичный статический Метод

Verifies the given ASN.1 encoded ECDSA signature against a hash using the public key.
public static Verify ( byte data, byte signature, byte pub ) : bool
data byte Hash of the data to verify.
signature byte ASN.1 encoded signature.
pub byte The public key bytes to use.
Результат bool