RSA Encryption Maximum Number of Bytes

The maximum number of bytes you can encrypt using RSA depends on the key size and the padding scheme. 1. Key Size The RSA key size determines the maximum size of the plaintext that can be encrypted. The larger the key size (e.g., 1024, 2048, 4096 bits), the larger the block of plaintext that can be encrypted. However, the actual […]

More Information about RSA OAEP Padding for Encryption

Optimal Asymmetric Encryption Padding (OAEP) is a padding scheme used in RSA encryption to provide additional security by introducing randomness and structure to the plaintext before encryption. Key Features of OAEP Padding Randomness: Incorporates a randomly generated seed to ensure the same plaintext encrypts to different ciphertexts each time, enhancing security. Two-step Masking: Uses a Mask Generation Function (MGF) to […]

RSA Signatures and Endianness

RSA Signatures and Endianness RSA signatures are represented as large integers, and the byte order (endianness) determines how the bytes of these integers are stored and transmitted. The two common formats are: Big-endian: The most significant byte (MSB) comes first. This is the traditional format used in network protocols and cryptography. Little-endian: The least significant byte (LSB) comes first. Commonly […]

PKCS7 (CMS) Encryption vs RSA Encryption

The difference between PKCS7 (CMS) encryption and RSA encryption lies in their purpose, scope, and how they handle encryption. * Output size differences are described further below. PKCS7 (CMS) Encryption Type: A data format and protocol, not an encryption algorithm itself. Purpose: Used for encrypting data and supporting digital signatures in a standard format. Mechanism: PKCS7 (or CMS, Cryptographic Message […]

RSA – Matching OpenSSL Signature w/ Chilkat

The following problem is common. The goal is to match the signature produced by this OpenSSL command w/ Chilkat: cat in.txt | openssl dgst -sha1 -sign myPrivateKey.pem | openssl enc -base64 The “gotcha” is when the input text file ends with a linefeed character (a single byte having value 0x0A), but the programmer does not realize it. The bytes passed […]

Create Amazon CloudFront Signed URL in VBScript (for ASP)

This sample code snippet is graciously provided by a Chilkat customer: See Also: Chilkat RSA ActiveX Reference Documentation … resource = “http://*********.cloudfront.net/something.jpg” ‘Expiration expiration = 1278680686 ‘Policy policy = “{“”Statement””:[{“”Resource””:””” & resource & _ “””,””Condition””:{“”DateLessThan””:{“”AWS:EpochTime””:” & _ expiration & “}}}]}” ‘Chilkat Component set pkey = Server.CreateObject(“Chilkat.PrivateKey”) ‘Load the private key from an RSA PEM file: private_key = pkey.LoadPemFile(“c:\pk-xxx.pem”) ‘Get the […]

Saving an RSA key pair to a file

Question: I’m having trouble finding a good/complete VB.Net Chilkat example of how to generate an RSA key container with a key pair (private and public) and save that key container to a file. Answer: I think I can clarify.  With 2 points: 1) In actuality, an RSA private key also contains the public-part of the key.  It contains the all […]

Java Create Signature / Chilkat Verify Interoperability

The following Java code produces a digital signature that can be verified using Chilkat RSA.  Links to the Chilkat signature verification examples follow this code.  The Java signature creation code does not use Chilkat to produce the digital signature.  It also demonstrates how to save a generated key (public and private) to DER files that can be used with Chilkat […]

Chilkat 9.0.2 Release Notes

RSA Fixed PEM to XML conversion so that XML is compatible with .NET Framework’s XML requirements. Fixed RSA key generation. In some cases, RSA generated keys were not valid. Verified key acceptance and signature matching between Chilkat, OpenSSL, and .NET MIME / DKIM Fixed DKIM and DomainKeys signature generation. Tested and verified DKIM / DomainKeys signatures in emails sent to […]

OAEP Padding vs. PKCS v1.5 Padding Error

This error occurs if RSA encrypted data using OAEP padding is decrypted with the assumption that PKCS v1.5 padding was used. To solve the problem, set the OaepPadding property = true prior to decrypting. … RSA_decrypt: KeyType: Private InputSize: 128 Padding: PKCS v1.5 ModulusBitLen: 1024 Invalid PKCS v1.5 padding header (1) FoundBlockType: 197 ExpectingBlockType: 2 …