Paul James Mallon also admitted supplying herbal cannabis.
Both offences occurred between June 5 and June 10 in 2012.
Mallon, of Castle Hill, Dungannon in Co. Tyrone, had originally denied the charges but changed his plea to guilty before his trial was due to get under way at Bishop Street Courthouse.
Ordering pre-sentence reports at Derry Crown Court, Judge Phillip Babington released the accused on bail to appear before him again for sentencing on March 24 next month.
However, Mallon could go to jail despite his guilty pleas.