In the EASA zone:
All parts fitted to an aircraft must have tractability and an appropriate certification. In the case of Aircraft General Spares, I.E. non special bolts, screws and o-rings a certificate of conformity will do, other parts will require an EASA form 1 issued by an approved company.
The use of parts from a donor aircraft can be problematic. Unless a company is appropriately approved to work on the specific uninstalled component and then certify it/them components can only be removed as serviceable. In general either of the above can only be carried out by a suitably approved person and/or organisation.
The issue of aircraft spares is a long and colourful one with numerous cases of people ending up in jail for having supplied bogus parts that is parts that are not fit for aircraft.
I have generalised and simplified the issue as far as I could but would suggest that the mere fact that you asked the question means you are totally unqualified to do this and run a serious risk of meeting your local airworthiness authority with a police man, or worse still being sued and loosing everything you own.