javaextensions/satsa/crypto/src/keyfactoryimpljni.cpp
branchRCL_3
changeset 19 04becd199f91
equal deleted inserted replaced
16:f5050f1da672 19: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:  JNI Layer corresponding to KeyFactory.java
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #include "com_nokia_mj_impl_security_KeyFactoryImpl.h"
       
    20 
       
    21 #include "stssignaturefactory.h"
       
    22 
       
    23 using namespace java::satsa;
       
    24 
       
    25 /**
       
    26  * JNI function.
       
    27  */
       
    28 JNIEXPORT jboolean JNICALL Java_com_nokia_mj_impl_security_KeyFactoryImpl__1isValidAlgorithm
       
    29 (JNIEnv* aJni, jclass, jstring aAlgorithm)
       
    30 {
       
    31 
       
    32     // KeyFactory can only be used with signatures.
       
    33     return STSSignatureFactory::IsSupportedAlgorithm(aJni,
       
    34             aAlgorithm);
       
    35 }
       
    36 
       
    37 /**
       
    38  * JNI function.
       
    39  */
       
    40 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_security_KeyFactoryImpl__1isValidKey
       
    41 (JNIEnv* aJni, jclass,
       
    42  jstring aKeyAlgorithm,
       
    43  jstring aKeyFormat,
       
    44  jbyteArray aKeyEncoded)
       
    45 {
       
    46 
       
    47     jint retVal = 0;
       
    48 
       
    49     // Call InitVerify
       
    50     retVal = STSSignatureFactory::IsValidKey(aJni,
       
    51              aKeyAlgorithm,
       
    52              aKeyFormat,
       
    53              aKeyEncoded);
       
    54 
       
    55     return retVal;
       
    56 }
       
    57