func (peer *peerImpl) TransactionPreValidation(tx *obc.Transaction) (*obc.Transaction, error) {
	if !peer.isInitialized {
		return nil, utils.ErrNotInitialized
	}
	peer.node.log.Debug("Tx confdential level [%s].", tx.ConfidentialityLevel.String())
	if tx.Cert != nil && tx.Signature != nil {
		cert, err := utils.DERToX509Certificate(tx.Cert)
		if err != nil {
			peer.node.log.Error("TransactionPreExecution: failed unmarshalling cert [%s] [%s].", err.Error())
			return tx, err
		}
		signature := tx.Signature
		tx.Signature = nil
		rawTx, err := proto.Marshal(tx)
		if err != nil {
			peer.node.log.Error("TransactionPreExecution: failed marshaling tx [%s] [%s].", err.Error())
			return tx, err
		}
		tx.Signature = signature
		ok, err := peer.node.verify(cert.PublicKey, rawTx, tx.Signature)
		if err != nil {
			peer.node.log.Error("TransactionPreExecution: failed marshaling tx [%s] [%s].", err.Error())
			return tx, err
		}
		if !ok {
			return tx, utils.ErrInvalidTransactionSignature
		}
	} else {
		if tx.Cert == nil {
			return tx, utils.ErrTransactionCertificate
		}
		if tx.Signature == nil {
			return tx, utils.ErrTransactionSignature
		}
	}
	return tx, nil
}
TransactionPreValidation verifies that the transaction is
well formed with the respect to the security layer
prescriptions (i.e. signature verification).
package crypto
import (
	"github.com/golang/protobuf/proto"
	"github.com/openblockchain/obc-peer/openchain/crypto/utils"
	obc "github.com/openblockchain/obc-peer/protos"
)
type peerImpl struct {
	node *nodeImpl
	isInitialized bool
}
func (peer *peerImpl) GetName() string {
	return peer.node.GetName()
}
func (peer *peerImpl) GetID() []byte {
	return utils.Clone(peer.node.id)
}
func (peer *peerImpl) GetEnrollmentID() string {
	return peer.node.enrollID
}