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

Developer

API Reference

IRSA_DECRYPT()

Brew Release
Brew MP 1.0.2
See Also
Error Codes IRSA
Description
This routine decrypts given data using the exponent and modulus specified previously using the IRSA_Init(). It strips the padding according the the pad type parameter, and returns the plaintext data to the user.
Params
pIRSA
[]:
pointer to the IRSA interface.
pbIn
[]:
[in] pointer to buffer of data to decrypt.
cbIn
[]:
[in] length of input buffer.
pbOut
[]:
[out] pointer to buffer to store encrpypted data, caller allocated.
pcbOut
[]:
[in/out] length of output buffer on input, length of data on output.
ePadType
[]:
[in] type of padding to use.
pdwResult
[]:
[out] result code.
pCB
[]:
[in] completion callback.
Interface
Prototype
  •    void IRSA_Decrypt
       (
          IRSA* pIRSA, 
          const byte* pbIn, 
          int cbIn, 
          byte* pbOut, 
          int *pcbOut,  
          int ePadType, 
          uint32* pdwResult, 
          AEECallback *pCB 
       );
    
Return
  • None. Result codes are returned through the pdwResult parameter.
    AEE_SUCCESS: if task is successful. AEE_CRYPT_INVALID_KEY: key not set, Init not called. AEE_CRYPT_INVALID_SIZE: pbIn is bigger than the modulus. AEE_ENOMEMORY: ran out of memory while processing. AEE_CRYPT_BUFFER_TOO_SMALL: output buffer to small. AEE_CRYPT_INVALID_PADTYPE: padding type given was wrong. AEE_CRYPT_ROLLBACKATTACK: when decoding SSL padding. AEE_CRYPT_PAD_ERROR: after decryption, padding decoding failed (which probably means that decryption was with the wrong key or otherwise failed) AEE_ECLASSNOTSUPPORT: internal depedency failure, unable to instantiate an object of class implementing hash function needed to complete the operation.
    This method can return errors returned by CreateInstance of internal dependency classes.
Side Effect
  • None
Comments
This routine does a private or public decrypt based on how the caller has configured the IRSA object beforehand and the padding type the user specifies. With typical key pairs decrypt is usually a private operation and is very slow. The input data, pbIn, must be valid until the callback is called. The data is not copied. ePadType should be as described in IRSA_Encrypt(). The operation may be cancelled by calling CALLBACK_Cancel() on pCB.