Endianness of EVP_PKEY_encryp output

Viken Kondakji Viken.Kondakji at Instinet.com
Wed Apr 5 12:34:09 UTC 2023

Re my question about endianness, I am not in control.
I am required to do what the target destination tells me to do.  It is that simple.

So, I ask again:
Will the binary output of the EVP_PKEY_encrypt on a small-endian host produce binary data in big-endian?
Can anyone help, please.

Viken Kondakji

-----Original Message-----
From: openssl-users <openssl-users-bounces at openssl.org> On Behalf Of Viktor Dukhovni
Sent: Tuesday, April 4, 2023 8:04 PM
To: openssl-users at openssl.org
Subject: Re: Endianness of EVP_PKEY_encryp output

Caution: External EmailThis email originated from an external source. If this email appears suspicious or you are uncertain of its authenticity, do not click any links or attachments or otherwise act upon it until you have consulted your local Instinet Help Desk.

On Tue, Apr 04, 2023 at 11:02:33PM +0000, Viken Kondakji wrote:

> I am using EVP_PKEY_encrypt, and running on a little-endian host using 
> RSA public key.  Will the binary output of my encryption be in 
> big-endian?

Your mistake is using EVP_PKEY_encrypt() directly, rather than a high level primitive, like CMS_EncryptedData_encrypt().

> The target destination wants the binary data in big-endian and then 
> encoded to base 64.

If they are looking for raw RSA signatures, they too are misguided.

> A man of EVP_PKEY_encrypt(3) on my host does not mention any 
> endianness.

You shouldn't be using this function directly.  It is only for use in higher-level protocols.  Naive misuse inevitably leads to significant security issues.


****Disclaimer****This message, including all attachments, is private and confidential, may contain proprietary or privileged information and material and is intended solely for use by the named addressee(s). If you receive this transmission in error, please immediately notify the sender and destroy this message in its entirety, whether in electronic or hard copy format. Any unauthorized use (and reliance thereon), copying, disclosure, retention, or distribution of this transmission or the material herein is forbidden. We reserve the right to retain, monitor, intercept and archive electronic communications. This message does not constitute an offer or solicitation with respect to the purchase or sale of any security. It should not be construed to contain any recommendation regarding any security or strategy unless expressly stated therein. Any reference to the terms of executed transactions should be treated as preliminary only and subject to formal written confirmation. Any views expressed are those of the individual sender, except where the message states otherwise and the sender is authorized to state them to be the views of any such entity. This message is provided on an “as is” basis. It contains material that is owned by Instinet Incorporated, its subsidiaries or its or their licensors, and may not, in whole or in part, be (i) copied, photocopied or duplicated in any form, by any means, or (ii) redistributed, posted, published, excerpted, or quoted without Instinet Incorporated's prior written consent. No confidentiality or privilege is waived or lost by any mistransmission of this message. Instinet, LLC (member SIPC) and Instinet Canada Limited, Member – Canadian Investor Protection Fund are subsidiaries of Instinet Incorporated that are locally registered or otherwise authorized to provide securities brokerage products and services. Please refer to the following links for additional disclosures and disclaimers that apply to this message. In the United States: http://instinet.com/docs/legal/le_disclaimers.html. In Canada: http://www.instinet.com/docs/legal/le_ca_disclosures.html. Canadian residents: You are receiving this electronic communication because of your existing relationship with Instinet Canada Limited or an authorized affiliate. Canadian residents who wish to unsubscribe from commercial electronic messages: please e-mail iclcompliance at instinet.com. Please note that you will continue to receive non-commercial electronic messages, such as account statements, invoices, client communications, and other similar factual electronic communications.
For recipients of Wolfe research, please see https://www.nomuranow.com/research/globalresearchportal/pages/disclosures/disclosures.aspx. for important research-related disclosures.

More information about the openssl-users mailing list