javaextensions/satsa/crypto/src/stsrsacipher.h
branchRCL_3
changeset 14 04becd199f91
equal deleted inserted replaced
13:f5050f1da672 14:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2008 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 the functionality of a RSA based cryptographic
       
    15  *                cipher for encryption and decryption.
       
    16  *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef STSRSACIPHER_H
       
    21 #define STSRSACIPHER_H
       
    22 
       
    23 //  INCLUDES
       
    24 
       
    25 #include "stscipher.h"  // Base class
       
    26 #include <openssl/rsa.h>
       
    27 #include <openssl/pem.h>
       
    28 #include <openssl/x509.h>
       
    29 #include <openssl/evp.h>
       
    30 
       
    31 class CRSAPKCS1v15Decryptor;
       
    32 class CRSAPKCS1v15Encryptor;
       
    33 class CRSAPublicKey;
       
    34 class CDecPKCS8Data;
       
    35 
       
    36 namespace java
       
    37 {
       
    38 namespace satsa
       
    39 {
       
    40 
       
    41 // CLASS DECLARATION
       
    42 /**
       
    43  *  Implements encryption and decryption cipher functionality for RSA algorithm.
       
    44  *
       
    45  */
       
    46 class STSRSACipher: public STSCipher
       
    47 {
       
    48 public:
       
    49 
       
    50 public:
       
    51 
       
    52     /**
       
    53      * Creates new STSRSACipher
       
    54      */
       
    55     static STSRSACipher* Create(int* errCode);
       
    56 
       
    57     virtual ~STSRSACipher();
       
    58 
       
    59 public:
       
    60     // From STSCipher
       
    61     // Functions from STSCipher
       
    62 
       
    63     jint DoInit(JNIEnv* aJni, const TCipherMode aMode,
       
    64                 const jstring aKeyAlgorithm, const jstring aKeyFormat,
       
    65                 const jbyteArray aKeyEncoded, const jbyteArray aParams);
       
    66 
       
    67     jint DoFinal(JNIEnv* aJni, jbyteArray aInput, jint aInputOffset,
       
    68                  jint aInputLength, jbyteArray aOutput, jint aOutputOffset);
       
    69 
       
    70     jint Update(JNIEnv* aJni, jbyteArray aInput, jint aInputOffset,
       
    71                 jint aInputLength, jbyteArray aOutput, jint aOutputOffset);
       
    72 
       
    73 protected:
       
    74 
       
    75     /**
       
    76      * C++ default constructor.
       
    77      */
       
    78     STSRSACipher();
       
    79 private:
       
    80 
       
    81     // Cipher's mode: EEncrypt or EDecrypt.
       
    82     TCipherMode mMode;
       
    83 
       
    84     RSA *mRSA;
       
    85     EVP_PKEY *mpkey;
       
    86 
       
    87 };
       
    88 } // namespace satsa
       
    89 } // namespace java
       
    90 #endif // STSRSACIPHER_H
       
    91 // End of File