|
1 /* |
|
2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Provides class for AES CM 128 bit encryption/decryption. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #include "srtpcipher_aescm128.h" |
|
22 #include "srtpaesctrcrypto.h" |
|
23 |
|
24 // --------------------------------------------------------------------------- |
|
25 // CSRTPCipherAESCM128::NewL |
|
26 // --------------------------------------------------------------------------- |
|
27 // |
|
28 CSRTPCipherAESCM128* CSRTPCipherAESCM128::NewL() |
|
29 { |
|
30 CSRTPCipherAESCM128* self = CSRTPCipherAESCM128::NewLC(); |
|
31 CleanupStack::Pop(self); |
|
32 return self; |
|
33 } |
|
34 |
|
35 // --------------------------------------------------------------------------- |
|
36 // CSRTPCipherAESCM128::NewLC |
|
37 // --------------------------------------------------------------------------- |
|
38 // |
|
39 CSRTPCipherAESCM128* CSRTPCipherAESCM128::NewLC() |
|
40 { |
|
41 CSRTPCipherAESCM128* self = new( ELeave ) CSRTPCipherAESCM128(); |
|
42 CleanupStack::PushL( self ); |
|
43 self->ConstructL(); |
|
44 return self; |
|
45 } |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // CSRTPCipherAESCM128::TransformL |
|
49 // --------------------------------------------------------------------------- |
|
50 // |
|
51 HBufC8* CSRTPCipherAESCM128::TransformL(const TDesC8& aKey, |
|
52 const TDesC8& aIV, |
|
53 const TDesC8& aSrc ) |
|
54 { |
|
55 // encrypt/decrypt using CSrtpAESCTRCrypto |
|
56 return iCipher->EncryptL(aKey, aIV, aSrc); |
|
57 } |
|
58 |
|
59 // --------------------------------------------------------------------------- |
|
60 // CSRTPCipherAESCM128::ConstructL |
|
61 // --------------------------------------------------------------------------- |
|
62 // |
|
63 void CSRTPCipherAESCM128::ConstructL() |
|
64 { |
|
65 // Create AES-CTR Wrapper |
|
66 iCipher = CSrtpAESCTRCrypto::NewL(); |
|
67 |
|
68 } |
|
69 |
|
70 // --------------------------------------------------------------------------- |
|
71 // CSRTPCipherAESCM128::~CSRTPCipherAESCM128 |
|
72 // --------------------------------------------------------------------------- |
|
73 // |
|
74 CSRTPCipherAESCM128::~CSRTPCipherAESCM128() |
|
75 { |
|
76 // delete AES-CTR Wrapper |
|
77 delete iCipher; |
|
78 } |
|
79 |
|
80 // --------------------------------------------------------------------------- |
|
81 // CSRTPCipherAESCM128::CSRTPCipherAESCM128 |
|
82 // --------------------------------------------------------------------------- |
|
83 // |
|
84 CSRTPCipherAESCM128::CSRTPCipherAESCM128() |
|
85 { |
|
86 |
|
87 } |