C# Class BitSharper.EcKey

Afficher le fichier Open project: TangibleCryptography/BitSharper Class Usage Examples

Méthodes publiques

Méthode Description
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.

Private Methods

Méthode Description
EcKey ( ) : System
ExtractPrivateKeyFromAsn1 ( byte asn1PrivKey ) : BigInteger
PublicKeyFromPrivate ( BigInteger privKey ) : byte[]

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

Method Details

EcKey() public méthode

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
Résultat System

FromAsn1() public static méthode

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
Résultat EcKey

GetPrivKeyBytes() public méthode

Returns a 32 byte array containing the private key.
public GetPrivKeyBytes ( ) : byte[]
Résultat byte[]

GetPrivateKeyEncoded() public méthode

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
Résultat DumpedPrivateKey

Sign() public méthode

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
Résultat byte[]

ToAddress() public méthode

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
Résultat Address

ToAsn1() public méthode

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[]
Résultat byte[]

ToString() public méthode

public ToString ( ) : string
Résultat string

Verify() public méthode

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.
Résultat bool

Verify() public static méthode

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.
Résultat bool