javaextensions/satsa/crypto/javasrc/java/security/Signature.java
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:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 package java.security;
       
    21 
       
    22 
       
    23 import com.nokia.mj.impl.security.SignatureImpl;
       
    24 import java.security.PrivSignatureImpl;
       
    25 
       
    26 /**
       
    27  * Refer JSR-177 Specification for details
       
    28  */
       
    29 public abstract class Signature
       
    30 {
       
    31     /**
       
    32      * Signature implementation
       
    33      */
       
    34     private SignatureImpl iSignature;
       
    35 
       
    36     /**
       
    37      * Package private constructor.
       
    38      */
       
    39     Signature(SignatureImpl aSignature)
       
    40     {
       
    41         iSignature = aSignature;
       
    42     }
       
    43 
       
    44     /**
       
    45     * Refer JSR-177 Specification for details
       
    46     */
       
    47     static public Signature getInstance(String aAlgorithm)
       
    48     throws NoSuchAlgorithmException
       
    49     {
       
    50         SignatureImpl signatureImpl = new SignatureImpl(aAlgorithm);
       
    51         return new PrivSignatureImpl(signatureImpl);
       
    52     }
       
    53 
       
    54     /**
       
    55     * Refer JSR-177 Specification for details
       
    56     */
       
    57     public final void initVerify(PublicKey aPublicKey)
       
    58     throws InvalidKeyException
       
    59     {
       
    60         iSignature.initVerifyImpl(aPublicKey);
       
    61     }
       
    62 
       
    63     /**
       
    64     * Refer JSR-177 Specification for details
       
    65     */
       
    66     public final void update(byte[] aData, int aOffset, int aLength)
       
    67     throws SignatureException
       
    68     {
       
    69         iSignature.updateImpl(aData, aOffset, aLength);
       
    70     }
       
    71 
       
    72     /**
       
    73     * Refer JSR-177 Specification for details
       
    74     */
       
    75     public final boolean verify(byte[] aSignature) throws SignatureException
       
    76     {
       
    77         return iSignature.verifyImpl(aSignature);
       
    78     }
       
    79 
       
    80 }