What is the etymology of the word cock-sure?

In the early 1600s, cock was a euphemism for God. It would have been used in a similar way to "as God is my witness."