Sun Adapter for SAG API

com.stc.connector.sagadapter.jni.sag
Class LMAC

java.lang.Object
  extended by com.stc.connector.sagadapter.jni.sag.LMAC

public class LMAC
extends java.lang.Object

Wrapper class for SAG C++ Message class. It is derived from sagapp.hpp. This class is designed to compute and verify local message authentication codes (LMAC).

Version:
cvs revision: $Revision: 1.4 $ Last Modified: $Date: 2007/10/19 19:48:39 $
Author:
Harry Liu (harry.liu@sun.com)

Constructor Summary
LMAC()
          Creates a new instance of Message
 
Method Summary
static void compute(java.lang.String key, java.lang.String algorithm, Message msg)
          Computes the LMAC.
static java.lang.String compute(java.lang.String key, java.lang.String algorithm, java.lang.String address)
          Computes the LMAC.
 void free()
          Method free.
static void verify(java.lang.String key, java.lang.String algorithm, Message msg)
          Verifies the LMAC that is set in the local authentication field of the message.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LMAC

public LMAC()
Creates a new instance of Message

Method Detail

free

public void free()
Method free.


compute

public static void compute(java.lang.String key,
                           java.lang.String algorithm,
                           Message msg)
                    throws ExcStatus
Computes the LMAC. It sets the LMAC in the local authentication field of the message. A key having an incorrect format raises an exception.

Parameters:
key - Bilateral key of 256 bits (a binary content of 32 octets).
algorithm - SAG 6.0.0 implements only the following algorithm: HMAC_SHA256
msg - The message used to compute LMAC.
Throws:
ExcStatus - when error occurs

compute

public static java.lang.String compute(java.lang.String key,
                                       java.lang.String algorithm,
                                       java.lang.String address)
                                throws ExcStatus
Computes the LMAC. It returns the LMAC as a function result that is ready to use for the subscription. A key having an incorrect format raises an exception.

Parameters:
key - Bilateral key of 256 bits (a binary content of 32 octets).
algorithm - SAG 6.0.0 implements only the following algorithm: HMAC_SHA256
address - Argument to set with the message partner name. This name is used as the address of the server traffic of a message partner.
Returns:
The LMAC value.
Throws:
ExcStatus - when error occurs

verify

public static void verify(java.lang.String key,
                          java.lang.String algorithm,
                          Message msg)
                   throws ExcStatus
Verifies the LMAC that is set in the local authentication field of the message. A wrong LMAC raises an exception describing the error: Sag:APL-I.004.004 - Local authentication has failed.

Parameters:
key - Bilateral key of 256 bits (a binary content of 32 octets).
algorithm - SAG 6.0.0 implements only the following algorithm: HMAC_SHA256
msg - The message used to verify LMAC.
Throws:
ExcStatus - when error occurs

Sun Adapter for SAG API

Copyright © 2008 Sun Microsystems, Inc. All rights reserved.