It is not possible to ensure a number is power of two primes (without effectively factoring the number). NIST has defined tests which are used in context of validating RSA public key, which you could use.
NIST recommends following tests (from NIST SP 800-89, section 5.3.3) for testing RSA public keys (which are supposedly product of two prime numbers):
- The length of the modulus is one of the specified values in FIPS 186-3.
- The value of the public exponent is in the valid range, as specified in FIPS 186-3.
- The modulus and the public exponent are odd numbers.
- The modulus is composite, but not a power of a prime
- The modulus has no factors smaller than 752. Testing for additional factors is allowed.
The tests 1-2 are specific to NIST specifications for RSA, however, tests 3-5 are generally useful. In your case also test 1 applies: 2048-bit was the size the question was about. Apply the tests for modulus to your large 2048-bit number. After these tests, it is (probably) proven that the number:
- has no small factors (test 5)
- the number is not a prime or a power of prime (test 4)
Test 4 is usually implemented using tests from FIPS 186-3 (enhanced Miller-Rabin test).
Note: in case the test 5 fails, it is still possible that the number is indeed product of two primes. (I.e. one of factors is a small prime and another is a large prime.) Such numbers are valid for "product of two primes", but are not useful in some cryptographic algorithms such as RSA.
All these tests will not prove that the value is product of two primes. Instead, a product of more primes may still pass the tests. A prime number, however, will be very unlikely to pass above tests.
These tests are convenient to implement in the sense that if you have cryptographic module which is capable of generating key for RSA, many of the tests are likely already implemented by it.
BTW, in case this is about RSA, you could be able to use some other means of public key validity checking, including e.g. TTP Key Pair Validation.