PrevNextUpHome SophiaFramework UNIVERSE 5.3
SFBBN
Wrapper Class for the IBN interface.
#include <SFBBN.h.hpp>
class SFBBN : public SFBQuery;
SFMTYPEDEFWRAPPER(SFBBN)

Inheritance diagram

 Inheritance diagram of SFBBNClass

Version

BREW 2.0 BREW 2.1 BREW 3.1 BREW 4.0
X X X O

Reference

BREW API IBN

Member

Public Functions
SFCError Add( SFBBNConstRef param )
Add given BN to self.
SFCError Cmp( SFBBNConstRef param )
Compares "me" with Arg and returns the result
SFCError Copy( SFBBNRef param )
Copy sets the current BN contents to that of the cpiArg.
SFCError Div( SFBBNConstRef divisor , SFBBNRef quotient )
Divide self with the divisor in resulting quotient. The "me" is set to the remainder.
SFCError Get( VoidPtr buf , SInt32Ptr size )
Copies the contents of the BN to the provided buffer.
SFCError Get( SFXBufferPtr buf )
Copies the contents of the BN to the provided buffer.
Void ModExp( SFBBNConstRef exp , SFBBNConstRef modulus , SInt32Ptr result , SFXCallbackPtr callback )
Computes the modular exponentiation of the BN and updates itself with the result.
SFCError ModMul( SFBBNConstRef multiplier , SFBBNConstRef modulus )
Computes the modular multiplication of the BN and updates itself with the result.
SFCError Mul( SFBBNConstRef param )
Multiply argument with self.
SFCError New( VoidConstPtr buf , SInt32 len , SFBBNSmpPtr pOut )
Factory method to construct a new SFBBN instead of calling CreateInstance.
SFCError New( SFXBufferConstRef buf , SFBBNSmpPtr pOut )
Factory method to construct a new SFBBN instead of calling CreateInstance.
static
SFBBNSmp
NewInstance( SFCErrorPtr exception = null )
Create a new SFBBN instance.
static
SFBBNSmp
NewInstance( AEECLSID id , SFCErrorPtr exception = null )
Create a new SFBBN instance.
SFCError Set( VoidConstPtr buf , SInt32 len )
Resets the contents of the BN to the newly provided buffer. If length is zero, the BN is set to zero.
SFCError Set( SFXBufferConstRef buf )
Resets the contents of the BN to the newly provided buffer. If length is zero, the BN is set to zero.
SFCError Sub( SFBBNConstRef param )
Subtract the argument from self. Only works if Arg is less than or equal to "me" value.
SFCError QueryInterface( AEECLSID clsid , VoidHandle handle ) (inherits from SFBQuery)
Ask an object for another API contract from the object in question.
SFCError QueryInterface( AEECLSID clsid , SFBBaseSmpPtr handle ) (inherits from SFBQuery)
Ask an object for another API contract from the object in question.
SFBBaseSmp QueryInterface( AEECLSID clsid ) (inherits from SFBQuery)
Ask an object for another API contract from the object in question.
Void Self( AEECLSID clsidReq , SFBQuerySmpPtr clone , AEECLSID clsidImp ) (inherits from SFBQuery)
Helper macro for those implementing an object with a single interface.
SFBQuerySmp Self( AEECLSID clsidReq , AEECLSID clsidImp ) (inherits from SFBQuery)
Helper macro for those implementing an object with a single interface.
Protected Functions
static
SFBBaseSmp
FactoryByCreate( AEECLSID id , SFCErrorPtr exception = null ) (inherits from SFBBase)
Create the instance for the specified ClassID's interface.
static
SFBBaseSmp
FactoryByQuery( SFBQuerySmpConstRef query , AEECLSID id , SFCErrorPtr exception = null ) (inherits from SFBBase)
Create the instance for the specified ClassID's interface using the SFBQuery instance.

SFBBN::Add
Add given BN to self.
[ public ]
SFCError Add(
    SFBBNConstRef param   // BN to add 
);

Return value

AEE_ENOMEMORY: on lack of memory

Reference

BREW API IBN_Add


SFBBN::Cmp
Compares "me" with Arg and returns the result
[ public ]
SFCError Cmp(
    SFBBNConstRef param   // BN to compare with 
);

Return value

  • -1: me is less than Arg (me < Arg )
  • 0: me is equal to Arg (me == Arg)
  • 1: me is greater than Arg (me > Arg )

Reference

BREW API IBN_Cmp


SFBBN::Copy
Copy sets the current BN contents to that of the cpiArg.
[ public ]
SFCError Copy(
    SFBBNRef param   // The BN to be copied from 
);

Return value

AEE_ENOMEMORY: On lack of memory.

Reference

BREW API IBN_Copy


SFBBN::Div
Divide self with the divisor in resulting quotient. The "me" is set to the remainder.
[ public ]
SFCError Div(
    SFBBNConstRef divisor   // Divisor BN
    SFBBNRef quotient       // Quotient BN; Can be NULL if not interested in the quotient 
);

Return value

AEE_ENOMEMORY: on lack of memory

Description

Side Effects: On failure, the value of "me" is undefined. If "me" is needed, make a copy before calling.

Reference

BREW API IBN_Div


SFBBN::Get
Copies the contents of the BN to the provided buffer.
[ public ]
SFCError Get(
    VoidPtr buf      // Byte array into which the BN value is copied. 
    SInt32Ptr size   // the size of buf
);
[ public ]
SFCError Get(
    SFXBufferPtr buf   // Byte array into which the BN value is copied. 
);

Argument

buf

Byte array into which the BN value is copied.

size

On input, set to the size of pubBuf. On output, it is set to the length of the copied buffer. On not enough space, it is set to the buffer size needed.

Return value

AEE_EFAILED: If target buffer does not have enough space

Description

Updates the pnSize with the real copies buffer size. On insufficient space, contains the maximum buffer size needed for the operation to succeed. The caller must always provide the pnSize pointer.

Reference

BREW API IBN_Get


SFBBN::ModExp
Computes the modular exponentiation of the BN and updates itself with the result.
[ public ]
Void ModExp(
    SFBBNConstRef exp         // Exponent BN 
    SFBBNConstRef modulus     // Modulus IBN
    SInt32Ptr result          // contains the result of the operation when done
    SFXCallbackPtr callback   // Callback to be called on completion
);

Return value

なし.

Description

Modulus must be odd (which is the case for most security related moduli). If the callback is null, the function is executed synchronously. The result is always provided in the pdwResult pointer.

This function SHOULD be used asynchronously because it can take a lot of time to complete depending on key size and if it is used synchronously then the application that uses this can get stuck for a while before it can respond.

Reference

BREW API IBN_ModExp


SFBBN::ModMul
Computes the modular multiplication of the BN and updates itself with the result.
[ public ]
SFCError ModMul(
    SFBBNConstRef multiplier   // The multiplier BN
    SFBBNConstRef modulus      // Modulus BN 
);

Return value

  • AEE_ENOMEMORY: on lack of memory
  • AEE_EBADPARM: if modulus is not a odd number

Description

Use this interface only if the same modulus is used repeatedly with SFBBN::ModMul and SFBBN::ModExp. It is slower than the method described below, due to some precomputation. If this needs to be called only once, construct this call by calling SFBBN::Mul and then calling SFBBN::Mod

Reference

BREW API IBN::ModMul


SFBBN::Mul
Multiply argument with self.
[ public ]
SFCError Mul(
    SFBBNConstRef param   // BN to multiply with 
);

Return value

AEE_ENOMEMORY: on lack of memory

Reference

BREW API IBN_Mul


SFBBN::New
Factory method to construct a new SFBBN instead of calling CreateInstance.
[ public ]
SFCError New(
    VoidConstPtr buf   // Holds the big number in an array, with 0th byte containing the LSB
    SInt32 len         // Length of buf
    SFBBNSmpPtr pOut   // Pointer to newly created SFBBN object
);
[ public ]
SFCError New(
    SFXBufferConstRef buf   // Holds the big number in an array, with 0th byte containing the LSB
    SFBBNSmpPtr pOut        // Pointer to newly created SFBBN object
);

Return value

  • AEE_SUCCESS: On success
  • AEE_ENOMEMORY: On lack of memory

Description

Provides a convenient way to create a BN and set its contents in one step, instead of calling CreateInstance and doing a SFBBN::Set call. On return, piOut contains the new BN or NULL in case of failure due to lack of memory. Note that the resulting IBN always uses the same implementation as the IBN that is used as input.

Reference

BREW API IBN::New


SFBBN::NewInstance
Create a new SFBBN instance.
[ public, static ]
SFBBNSmp NewInstance(
    SFCErrorPtr exception = null   // Error
);
[ public, static ]
SFBBNSmp NewInstance(
    AEECLSID id                    // Class ID
    SFCErrorPtr exception = null   // Error
);

SFBBN::Set
Resets the contents of the BN to the newly provided buffer. If length is zero, the BN is set to zero.
[ public ]
SFCError Set(
    VoidConstPtr buf   // Holds the big number in an array, with 0th byte having LSB
    SInt32 len         // Length of buf
);
[ public ]
SFCError Set(
    SFXBufferConstRef buf   // Holds the big number in an array, with 0th byte having LSB
);

Return value

AEE_ENOMEMORY: On lack of memory

Reference

BREW API IBN_Set


SFBBN::Sub
Subtract the argument from self. Only works if Arg is less than or equal to "me" value.
[ public ]
SFCError Sub(
    SFBBNConstRef param   // BN to subtract
);

Return value

AEE_EBADPARM: if arg is greater than "me"

Reference

BREW API IBN_Sub