public static Task <SecretKey> NewSignedPublicKeySecretKey(PublicServiceAccountKey publicAccountKey, Key key)
        {
            if (!key.IsPrivate || key.PublicKey != publicAccountKey.PublicKey)
            {
                throw new ArgumentException("Key is wrong", nameof(key));
            }

            var passphrase = $"{"SignedPublicKey"}.{Hex.ToString(key.RawData)}.{publicAccountKey.ChainId.ToString("X8")}.{publicAccountKey.AccountId.ToString("X8")}.{publicAccountKey.KeyIndex.ToString("X8")}";

            return(SecretKey.NewSecretKey(new PublicServiceAccountKeySecretKeyInfo(publicAccountKey), passphrase));
        }
Exemplo n.º 2
0
 protected override void UnpackData(Unpacker unpacker)
 {
     unpacker.Unpack(out long accountId);
     unpacker.Unpack(out int chainId);
     SignedPublicKey = new PublicServiceAccountKey(accountId, chainId, unpacker);
 }
Exemplo n.º 3
0
 public ServiceAccountKeyStore(string name, PublicServiceAccountKey signedPublicKey, Key key, string keyPassword) : base(KeyStoreTypes.ServiceAccount, name)
 {
     SignedPublicKey = signedPublicKey;
     EncryptKey(key, keyPassword);
 }
 protected PublicServiceAccountKeySecretKeyInfo(SecretKeyInfoTypes secretKeyInfoType, PublicServiceAccountKey signedPublicKey) : base(secretKeyInfoType, signedPublicKey.ChainId, signedPublicKey.AccountId, signedPublicKey.KeyIndex)
 {
 }
 public PublicServiceAccountKeySecretKeyInfo(PublicServiceAccountKey signedPublicKey) : base(SecretKeyInfoTypes.PublicServiceAccount, signedPublicKey.ChainId, signedPublicKey.AccountId, signedPublicKey.KeyIndex)
 {
 }
 public GroupSignedPublicKeySecretKeyInfo(long groupId, PublicServiceAccountKey signedPublicKey) : base(SecretKeyInfoTypes.GroupSignedPublicKey, signedPublicKey)
 {
     GroupId = groupId;
 }