Related to, of course, the heartbleed vulnerability, I've been reading the news about the worst case scenario for this attack being the extraction of the SSL private key, because, of course, this would allow the attacker to decrypt all traffic to and from the compromised server, including [probably, depending on forward secrecy] any traffic that's been captured and stored somewhere.
This got me thinking, assuming the worst case scenario, that your Heartbleed vulnerable server had echoed back memory containing your private key... how would the attacker be able to differentiate it from other memory contents, or uninitialized memory, or what have you? Is there a header/footer, or a telltale pattern in the key data itself? I know some RSA Key forms (PEM/base64) have headers/footers in the file (-----BEGIN FOO BAR KEY-----
and -----END FOO BAR KEY-----
), though I'm having trouble imagining those strings loaded into memory. Is it maybe given away by having something recognizable using a pointer to it?
It doesn't seem like something you can brute force (trying every X bit combination of memory content against 64 KB of memory seems like it would generate an astronomically large number of permutations).
So, how's it done? How is a cryptographic key in memory recognized as a cryptographic key? And in a related question, is the answer different or the same for a symmetrical crypto key? (such as you might extract with a cold boot attack against a system using full disk encryption, for example.)