class AergoKey implements KeyPair, Signer {

  @Override
  public Transaction sign(final RawTransaction rawTransaction) {
    try {
      logger.debug("Sign raw transaction: {}", rawTransaction);
      final TxHash withoutSignature = rawTransaction.calculateHash();
      final ECDSASignature ecdsaSignature =
          ecdsakey.sign(withoutSignature.getBytesValue().getValue());
      final Signature signature = serialize(ecdsaSignature);
      logger.trace("Raw signature: {}", ecdsaSignature);
      logger.trace("Serialized signature: {}", signature);
      final TxHash withSignature = rawTransaction.calculateHash(signature);
      final Transaction transaction = Transaction.newBuilder()
          .rawTransaction(rawTransaction)
          .signature(signature)
          .hash(withSignature)
          .build();
      return transaction;
    } catch (HerajException e) {
      throw e;
    } catch (Exception e) {
      throw new HerajException(e);
    }
  }

  public  AergoKey(final String encodedEncryptedPrivateKey, final String passphrase);
  public  AergoKey(final EncryptedPrivateKey encryptedPrivateKey, final String passphrase);
  public  AergoKey(final KeyFormat keyFormat, final String passphrase);
  protected <T extends Encrypted> AergoKey(final KeyCipherStrategy<T> strategy,
      final T encrypted, final String passphrase);
  public  AergoKey(final ECDSAKey ecdsakey);

}