iasrequest.cpp
// Decrypt then return the subscription key
Decrypt then return the subscription key
Decrypt then return the subscription key
string IAS_Connection::getSubscriptionKey()
{
	char keyBuff[IAS_SUBSCRIPTION_KEY_SIZE+1];
	memset(keyBuff, 0, IAS_SUBSCRIPTION_KEY_SIZE+1);
        for ( int i = 0; i < IAS_SUBSCRIPTION_KEY_SIZE; i++ )
                 keyBuff[i] = (subscription_key_enc[currentKeyID][i] ^ subscription_key_xor[currentKeyID][i]);
	string subscriptionKeyBuff(keyBuff);
        if ( debug ) {
                eprintf("\n+++ Reconstructed Subscription Key:\t'%s'\n", subscriptionKeyBuff.c_str());
		eprintf("+++ IAS Subscription Key (Hex):\t\t%s\n", hexstring(keyBuff, IAS_SUBSCRIPTION_KEY_SIZE));
                eprintf("+++ One-time pad:\t\t\t%s\n", hexstring(subscription_key_xor[currentKeyID], sizeof(subscription_key_xor[currentKeyID])));
                eprintf("+++ Encrypted SubscriptionKey:\t\t%s\n\n", hexstring(subscription_key_enc[currentKeyID],sizeof(subscription_key_enc[currentKeyID])));
                }
        return subscriptionKeyBuff;
}
string IAS_Connection :: getSubscriptionKey ( ) { char keyBuff [ IAS_SUBSCRIPTION_KEY_SIZE + 1 ] ; memset ( keyBuff , 0 , IAS_SUBSCRIPTION_KEY_SIZE + 1 ) ; for ( int i = 0 ; i < IAS_SUBSCRIPTION_KEY_SIZE ; i ++ ) keyBuff [ i ] = ( subscription_key_enc [ currentKeyID ] [ i ] ^ subscription_key_xor [ currentKeyID ] [ i ] ) ; string subscriptionKeyBuff ( keyBuff ) ; if ( debug ) { eprintf ( " \n \t \n " , subscriptionKeyBuff . c_str ( ) ) ; eprintf ( " \t \t \n " , hexstring ( keyBuff , IAS_SUBSCRIPTION_KEY_SIZE ) ) ; eprintf ( " \t \t \t \n " , hexstring ( subscription_key_xor [ currentKeyID ] , sizeof ( subscription_key_xor [ currentKeyID ] ) ) ) ; eprintf ( " \t \t \n \n " , hexstring ( subscription_key_enc [ currentKeyID ] , sizeof ( subscription_key_enc [ currentKeyID ] ) ) ) ; } return subscriptionKeyBuff ; }
Decrypt then return the subscription key
Decrypt then return the subscription key