public void Unprotect() { Assert.Equal(AddressFixture, Fixture.Address); Assert.Equal(AddressFixture, Fixture.Unprotect(PassphraseFixture).ToAddress()); Assert.Equal(AddressFixture2, Fixture2.Unprotect(PassphraseFixture).ToAddress()); var incorrectPassphraseException = Assert.Throws <IncorrectPassphraseException>( () => Fixture.Unprotect("wrong passphrase") ); TestUtils.AssertBytesEqual( MacFixture.ToImmutableArray(), incorrectPassphraseException.ExpectedMac ); Assert.NotEqual(MacFixture, incorrectPassphraseException.InputMac); var invalidPpk = new ProtectedPrivateKey(
public Signature Sign(Keccak message) { if (!CanSign) { throw new InvalidOperationException("Cannot sign without provided key."); } using var key = _key.Unprotect(); var rs = Proxy.SignCompact(message.Bytes, key.KeyBytes, out int v); return(new Signature(rs, v)); }