cryptoservices/certificateandkeymgmt/x509/x509cert.cpp
changeset 19 cd501b96611d
parent 8 35751d3474b7
child 33 cf642210ecb7
equal deleted inserted replaced
15:da2ae96f639b 19:cd501b96611d
   302 			iEncodedParams = HBufC8::NewL(1);
   302 			iEncodedParams = HBufC8::NewL(1);
   303 			*iEncodedParams = KNullDesC8;
   303 			*iEncodedParams = KNullDesC8;
   304 			CleanupStack::PopAndDestroy(2);//seq, oid
   304 			CleanupStack::PopAndDestroy(2);//seq, oid
   305 			return;
   305 			return;
   306 			}
   306 			}
       
   307 
       
   308         if (oidDes == KSHA224)
       
   309             {
       
   310             iAlgorithmId = ESHA224;
       
   311             TASN1DecNull null;
       
   312             null.DecodeDERL(*gen);//just to check the syntax is OK
       
   313             iEncodedParams = HBufC8::NewL(1);
       
   314             *iEncodedParams = KNullDesC8;
       
   315             CleanupStack::PopAndDestroy(2);//seq, oid
       
   316             return;
       
   317             }
       
   318         if (oidDes == KSHA256)
       
   319             {
       
   320             iAlgorithmId = ESHA256;
       
   321             TASN1DecNull null;
       
   322             null.DecodeDERL(*gen);//just to check the syntax is OK
       
   323             iEncodedParams = HBufC8::NewL(1);
       
   324             *iEncodedParams = KNullDesC8;
       
   325             CleanupStack::PopAndDestroy(2);//seq, oid
       
   326             return;
       
   327             }      
       
   328         if (oidDes == KSHA384)
       
   329             {
       
   330             iAlgorithmId = ESHA384;
       
   331             TASN1DecNull null;
       
   332             null.DecodeDERL(*gen);//just to check the syntax is OK
       
   333             iEncodedParams = HBufC8::NewL(1);
       
   334             *iEncodedParams = KNullDesC8;
       
   335             CleanupStack::PopAndDestroy(2);//seq, oid
       
   336             return;
       
   337             }        
       
   338         if (oidDes == KSHA512)
       
   339             {
       
   340             iAlgorithmId = ESHA512;
       
   341             TASN1DecNull null;
       
   342             null.DecodeDERL(*gen);//just to check the syntax is OK
       
   343             iEncodedParams = HBufC8::NewL(1);
       
   344             *iEncodedParams = KNullDesC8;
       
   345             CleanupStack::PopAndDestroy(2);//seq, oid
       
   346             return;
       
   347             }         
       
   348 	
   307 		}
   349 		}
   308 	User::Leave(KErrNotSupported);
   350 	User::Leave(KErrNotSupported);
   309 	}
   351 	}
   310 	
   352 	
   311 EXPORT_C CASN1EncSequence* CX509AlgorithmIdentifier::EncodeASN1DERLC() const
   353 EXPORT_C CASN1EncSequence* CX509AlgorithmIdentifier::EncodeASN1DERLC() const
   338 		break;
   380 		break;
   339 		
   381 		
   340 	case ESHA1:
   382 	case ESHA1:
   341 		oid=CASN1EncObjectIdentifier::NewLC(KSHA1);
   383 		oid=CASN1EncObjectIdentifier::NewLC(KSHA1);
   342 		break;
   384 		break;
       
   385 
       
   386 	case ESHA224:
       
   387 		oid=CASN1EncObjectIdentifier::NewLC(KSHA224);
       
   388 		break;
       
   389 
       
   390 	case ESHA256:
       
   391 		oid=CASN1EncObjectIdentifier::NewLC(KSHA256);
       
   392 		break;
       
   393 
       
   394 	case ESHA384:
       
   395 		oid=CASN1EncObjectIdentifier::NewLC(KSHA384);
       
   396 		break;
       
   397 
       
   398 	case ESHA512:
       
   399 		oid=CASN1EncObjectIdentifier::NewLC(KSHA512);
       
   400 		break;
   343 		
   401 		
   344 	default:
   402 	default:
   345 		User::Leave(KErrNotSupported);
   403 		User::Leave(KErrNotSupported);
   346 		}
   404 		}
   347 	
   405 	
   461 		TAlgorithmId algId = ERSA;
   519 		TAlgorithmId algId = ERSA;
   462 		TAlgorithmId digestId = ESHA1;
   520 		TAlgorithmId digestId = ESHA1;
   463 		iDigestAlgorithm = CAlgorithmIdentifier::NewL(digestId, encodedParams->Des());
   521 		iDigestAlgorithm = CAlgorithmIdentifier::NewL(digestId, encodedParams->Des());
   464 		iAsymmetricAlgorithm = CAlgorithmIdentifier::NewL(algId, encodedParams->Des());
   522 		iAsymmetricAlgorithm = CAlgorithmIdentifier::NewL(algId, encodedParams->Des());
   465 		}
   523 		}
       
   524 
       
   525 	if (oidDes == KSHA224WithRSA)
       
   526          {
       
   527          TAlgorithmId algId = ERSA;
       
   528          TAlgorithmId digestId = ESHA224;
       
   529          iDigestAlgorithm = CAlgorithmIdentifier::NewL(digestId, encodedParams->Des());
       
   530          iAsymmetricAlgorithm = CAlgorithmIdentifier::NewL(algId, encodedParams->Des());
       
   531          }
       
   532 	
       
   533 	if (oidDes == KSHA256WithRSA)
       
   534          {
       
   535          TAlgorithmId algId = ERSA;
       
   536          TAlgorithmId digestId = ESHA256;
       
   537          iDigestAlgorithm = CAlgorithmIdentifier::NewL(digestId, encodedParams->Des());
       
   538          iAsymmetricAlgorithm = CAlgorithmIdentifier::NewL(algId, encodedParams->Des());
       
   539          }
       
   540 
       
   541 	if (oidDes == KSHA384WithRSA)
       
   542          {
       
   543          TAlgorithmId algId = ERSA;
       
   544          TAlgorithmId digestId = ESHA384;
       
   545          iDigestAlgorithm = CAlgorithmIdentifier::NewL(digestId, encodedParams->Des());
       
   546          iAsymmetricAlgorithm = CAlgorithmIdentifier::NewL(algId, encodedParams->Des());
       
   547          }
       
   548 
       
   549 	if (oidDes == KSHA512WithRSA)
       
   550          {
       
   551          TAlgorithmId algId = ERSA;
       
   552          TAlgorithmId digestId = ESHA512;
       
   553          iDigestAlgorithm = CAlgorithmIdentifier::NewL(digestId, encodedParams->Des());
       
   554          iAsymmetricAlgorithm = CAlgorithmIdentifier::NewL(algId, encodedParams->Des());
       
   555          }
       
   556 
   466 		//???not sure if we should just leave here...
   557 		//???not sure if we should just leave here...
   467 	if (iDigestAlgorithm == NULL)
   558 	if (iDigestAlgorithm == NULL)
   468 		{	
   559 		{	
   469 		User::Leave(KErrNotSupported);
   560 		User::Leave(KErrNotSupported);
   470 		}
   561 		}