506 EXPORT_C void CSignedObject::ExternalizeL(RWriteStream& aStream) const |
527 EXPORT_C void CSignedObject::ExternalizeL(RWriteStream& aStream) const |
507 { |
528 { |
508 aStream.WriteInt32L(iEncoding->Length()); |
529 aStream.WriteInt32L(iEncoding->Length()); |
509 aStream.WriteL(*iEncoding); |
530 aStream.WriteL(*iEncoding); |
510 } |
531 } |
511 /* |
532 |
512 EXPORT_C void CSignedObject::ConstructL(RReadStream& aStream, TSignedObjectParser* aParser, TKeyFactory* aFactory) |
533 |
513 { |
|
514 if (iParser != NULL) |
|
515 { |
|
516 delete iParser; |
|
517 iParser = NULL; |
|
518 } |
|
519 iParser = aParser; |
|
520 if (iKeyFactory != NULL) |
|
521 { |
|
522 delete iKeyFactory; |
|
523 iKeyFactory = NULL; |
|
524 } |
|
525 iKeyFactory = aFactory; |
|
526 if (iEncoding != NULL) |
|
527 { |
|
528 User::Leave(KErrGeneral); |
|
529 } |
|
530 TInt len = aStream.ReadInt32L(); |
|
531 iEncoding = HBufC8::NewL(aStream,len); |
|
532 DoConstructL(); |
|
533 } |
|
534 |
|
535 EXPORT_C void CSignedObject::ConstructL(const TPtrC8& aBinaryData, TSignedObjectParser* aParser, TKeyFactory* aFactory) |
|
536 { |
|
537 iParser = aParser; |
|
538 iKeyFactory = aFactory; |
|
539 //take a copy of the whole thing |
|
540 iEncoding = aBinaryData.AllocL(); |
|
541 DoConstructL(); |
|
542 } |
|
543 |
|
544 EXPORT_C void CSignedObject::ConstructL(const CSignedObject& aSignedObject, TSignedObjectParser* aParser, TKeyFactory* aFactory) |
|
545 { |
|
546 iParser = aParser; |
|
547 iKeyFactory = aFactory; |
|
548 iEncoding = aSignedObject.iEncoding->AllocL(); |
|
549 iFingerprint = aSignedObject.iFingerprint->AllocL(); |
|
550 iSignature = aSignedObject.iSignature->AllocL(); |
|
551 iSigningAlgorithm = CSigningAlgorithmIdentifier::NewL(*(aSignedObject.iSigningAlgorithm)); |
|
552 } |
|
553 |
|
554 void CSignedObject::DoConstructL() |
|
555 { |
|
556 //generate your fingerprint |
|
557 CMD5* hash = CMD5::NewL(); |
|
558 CleanupStack::PushL(hash); |
|
559 iFingerprint = hash->Hash(Encoding()).AllocL(); |
|
560 CleanupStack::PopAndDestroy(); |
|
561 //ask the parser for the signature |
|
562 iSignature = iParser->SignatureL(Encoding()); |
|
563 //ask the parser for the algorithm ID |
|
564 iSigningAlgorithm = iParser->AlgorithmIdL(Encoding()); |
|
565 } |
|
566 */ |
|
567 //****************************************************************************************// |
534 //****************************************************************************************// |
568 //certificate base |
535 //certificate base |
569 EXPORT_C CCertificate::~CCertificate() |
536 EXPORT_C CCertificate::~CCertificate() |
570 { |
537 { |
571 delete iSerialNumber; |
538 delete iSerialNumber; |