API Reference | developer.brewmp.com API Reference | developer.brewmp.com

Developer

API Reference

IPUBKEYENG_NEW()

Brew Release
Brew MP 1.0.2
See Also
Description

This function is used to obtain context handles with which to perform cryptographic operations. It also provides a convenient way to have the key parameters copied to the context handle.
Params
pif
[in]:
Pointer to IPubKeyEng interface object
piParameters
[in]:
Optional parameters object that keys to initialize with. May be NULL.
piOutPubKey
[out]:
Pointer to copied IPubKey interface and binding to engine.
Interface
Prototype
  • int IPubKeyEng_New
      (
       IPubkeyEng *pif,
       const IParameters1 *piParameters,
       IPubKey **piOutPubKey
      )
    
Return

  • AEE_SUCCESS: piOutPubKey AEE_EBADPARM: piOutPubKey is NULL
    Other error codes related to problems with setting keys as generate by Engine.
Side Effect
  • None
Comments
If piParameters is provided those parameters are used to initialize the context returned. Different engines will copy different parameters. For example an RSA engine will copy RSA parameter, but not ECC parameters. Only the relevant parameters will be copied. Usually this is a very small number such as two or three. See implementation description for particular parameters copied. If some parameter that the engine tries to copy is unset or get via the IParameters1_GetParam method fails, this method will NOT return an error. The error will be returned later when a particular operations (e.g. decrypt) is attempted on the IPubKey fails because the parameter is unset. If a parameter the engine is trying to copy is not in the right form or syntax, or maybe a key is larger than what the engine can handle, the error may be returned here. Returning the AEE_CRYPT_INVALID_KEY error is such an example. But implementations are free to not return this or any other key get and set related error