Code sign error while running an IOS app on iPad device through xcode

This is my first web app development for any iOS device. Please pardon my ignorance and basic questions.

My environment is,

Xcode version: 4.2.1
Mac OS X: Software Mac OS X Lion 10.7.2 (11C74)
iPad: IOS 5.0.1


On my iMac I installed Xcode 4.2.1 from the app store.

I downloaded a sample hello world app from Apple library website. I opened the hello world app in Xcode on the iMac.

It runs perfectly fine on the iOS simulator (Xcode) on the iMac.

I connected the iPad to my iMac. The moment I connect the Xcode recognizes my iPad device and I set Xcode run to execute on the iPad device. Now I clicked on “Run” I get “Build failed” and the logs says the following (but the build is successful when I run in the simulator)

CodeSign /Users/johndoe/Library/Developer/Xcode/DerivedData/HelloWorld-dxztjuxsornpzsbseolkcsytxcfa/Build/Products/Debug-iphoneos/HelloWorld.app
cd /Users/johndoe/Downloads/HelloWorld_iPhone
setenv CODESIGN_ALLOCATE /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
setenv PATH “/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin”
/usr/bin/codesign --force --sign “iPhone Developer: John Doe (6U988729CX)” --resource-rules=/Users/johndoe/Library/Developer/Xcode/DerivedData/HelloWorld-dxztjuxsornpzsbseolkcsytxcfa/Build/Products/Debug-iphoneos/HelloWorld.app/ResourceRules.plist --entitlements /Users/johndoe/Library/Developer/Xcode/DerivedData/HelloWorld-dxztjuxsornpzsbseolkcsytxcfa/Build/Intermediates/HelloWorld.build/Debug-iphoneos/HelloWorld.build/HelloWorld.xcent /Users/johndoe/Library/Developer/Xcode/DerivedData/HelloWorld-dxztjuxsornpzsbseolkcsytxcfa/Build/Products/Debug-iphoneos/HelloWorld.app

/Users/johndoe/Library/Developer/Xcode/DerivedData/HelloWorld-dxztjuxsornpzsbseolkcsytxcfa/Build/Products/Debug-iphoneos/HelloWorld.app: replacing invalid existing signature
/Users/johndoe/Library/Developer/Xcode/DerivedData/HelloWorld-dxztjuxsornpzsbseolkcsytxcfa/Build/Products/Debug-iphoneos/HelloWorld.app: CSSMERR_TP_NOT_TRUSTED
Command /usr/bin/codesign failed with exit code 1

I seem to be missing something very basic. Any help is greatly appreciated. [import]uid: 115481 topic_id: 19930 reply_id: 319930[/import]