pkiutilities/PKCS12/CrPkcs12/Src/crpkcs12.cpp
branchRCL_3
changeset 5 3b17fc5c9564
parent 0 164170e6151a
--- a/pkiutilities/PKCS12/CrPkcs12/Src/crpkcs12.cpp	Tue Feb 02 00:44:34 2010 +0200
+++ b/pkiutilities/PKCS12/CrPkcs12/Src/crpkcs12.cpp	Fri Feb 19 23:42:03 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2004, 2010 Nokia Corporation and/or its subsidiary(-ies). 
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -1130,10 +1130,17 @@
                 }
             }
         }
+
+    if( !pkcs7EncryptedDataBuf )
+        {
+        CleanupStack::PopAndDestroy(numberOfItemsInCStack); // set
+        numberOfItemsInCStack = 0;
+        return EFalse;
+        }
+
     // OK, now we have buffer to be decrypted, used algorithm, salt and
     // an iteration count. Next we decrypt buffer and append it to iBags.
-	
-	DecryptPkcs7EncryptedDataL( pkcs7EncryptedDataBuf,salt,iter,algorithm );
+	DecryptPkcs7EncryptedDataL( pkcs7EncryptedDataBuf, salt, iter, algorithm );
 
     CleanupStack::PopAndDestroy(numberOfItemsInCStack);
     numberOfItemsInCStack = 0;
@@ -1309,7 +1316,6 @@
     {
     TInt numberOfItemsinCStack = 0;
     CCrBerSet* set = NULL;
-    TInt errData = KErrNone;
 
     set = CCrBerSet::NewLC( 1 );
     ++numberOfItemsinCStack;
@@ -1403,11 +1409,6 @@
     CleanupStack::PushL(encryptedPrivateKeyInfo);
     ++numberOfItemsinCStack;
     
-    if ( errData < KErrNone )
-        {
-        User::Leave(KErrArgument);
-        }
-
     // Decrypt
     if ( !DecryptPrivateKeyL( encryptedPrivateKeyInfo,
                                                  salt,