public static Key LoadNBEcKey(String base58) { byte[] b = Multibase.Decode(base58, out MultibaseEncoding encoding); EcKey key = EcKey.FromAsn1(b); return(new Key(key.GetPrivKeyBytes())); }
public static void SaveEcKey(Key nbEcKey, IResourceDataAccess resourceDataAccess) { byte[] bytes = EcKey.ToAsn1(nbEcKey.ToBytes(), nbEcKey.PubKey.ToBytes()); string base58 = Multibase.Encode(MultibaseEncoding.Base58Btc, bytes); resourceDataAccess.Save(base58); }
public static string sign(EcKey ecKey, string input) { // return ecKey.Sign(input); String hash = Sha256Hash(input); var hashBytes = hexToBytes(hash); var signature = ecKey.Sign(hashBytes); var bytesHex = bytesToHex(signature); return(bytesHex); //return bytesToHex(ecKey.Sign(hexToBytes(hash))); }
public static String DeriveSIN(EcKey ecKey) { byte[] pubKey = ecKey.PubKey; return(DeriveSIN(pubKey)); }