This paper describes a trust based security architecture for small/medium-sized mobile ad hoc networks. We designed and implemented a security architecture that extends the traditional PKI model, assigning variable trust values to digital certificates and issuing credentials to grant access to network services. Trust values are not static; they vary during regular network operation as network users provoke security incidents. Depending on the seriousness of the incidents the trust value associated to the offenders certificate will vary. Eventually, a series of security incidents may end up with the certificate revocation. We also developed a security framework for designing secure applications and built prototypes to test and validate our architecture. We considered service-oriented ad hoc networks, where every mobile device is classified as service providers or service users