code: func signEncryptAndPutState(stub shim.ChaincodeStubInterface, ent entities.EncrypterSignerEntity, key string, value []byte) error {
  	// here we create a SignedMessage, set its payload
  	// to value and the ID of the entity and
  	// sign it with the entity
  	msg := &entities.SignedMessage{Payload: value, ID: []byte(ent.ID())}
  	err := msg.Sign(ent)
  	if err != nil {
  		return err
  	}
  
  	// here we serialize the SignedMessage
  	b, err := msg.ToBytes()
  	if err != nil {
  		return err
  	}
  
  	// here we encrypt the serialized version associated to args[0]
  	return encryptAndPutState(stub, ent, key, b)
  }
docs: // signEncryptAndPutState signs the supplied value, encrypts
  // the supplied value together with its signature using the
  // supplied entity and puts it to the ledger associated to
  // the supplied KVS key