Computing Percent Identity between DNA / Amino Acid Sequence
tBLASTn, BLASTx and tBLASTx can be used.

It is clearly illustrated here.

If you have just two sequences you need not do a search against the database. You can simply align them using Smith-Waterman or Needleman-Wunsch algorithms, as David mentioned. However, you still need to translate your DNA to protein before doing the alignment. Again, as pointed out by David, with protein alignments you do usually not use identity. Scoring matrices like PAM or BLOSUM are used to calculate similarity.