Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8305329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:05:34+00:00 2026-06-08T18:05:34+00:00

I am using Libgcrypt with Elgamal to encrypt a block of bytes, and I

  • 0

I am using Libgcrypt with Elgamal to encrypt a block of bytes, and I am having 2 problems:

  1. When I do not use padding and my block of bytes starts which an zero byte, I lose the first byte during decryption;

  2. If I use padding the encryption works well, but when I decrypt the padding is not removed. And apparently the first zero byte still there.

With RSA I am having the same problem 🙁

My test code is there: http://www.tiago.eti.br/storage/post.c
And it do not use padding.

To use padding you need to change:

#define PADDING "raw"

to

#define PADDING "pkcs1"

And to change the encryption algorithm change:

#define ALG "elg"

to

#define ALG "rsa"

To compile you need to use:

gcc -Wall -g post.c -lgcrypt -o post

What can I do to solve it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T18:05:35+00:00Added an answer on June 8, 2026 at 6:05 pm

    I posted the same question in Libgcrypt mailing list and I had an answer.

    Libgcrypt until 1.5.0 does not remove the padding: it recognizes the flags but does nothing with the padding.

    So the solution is update Libgcrypt to 1.5.0.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use gpg generated public keys to do encryption using libgcrypt.
Using android 2.3.3, I have a background Service which has a socket connection. There's
Using MVC2 I have an AJAX form which is posting to a bound model.
Using Delphi 2010. I am looking for (possibly) a function or procedure which can
Like in the title, I want to encrypt data, which is sent over network.
Using MVVM. I have a DataTemplate which I am using to display an expander
I have some problems using OpenSSL. I'm following the tutorial for compiling OpenSSL for
my first question here: I am having trouble using libcURL in a c++ project.
Using PyObjC , you can use Python to write Cocoa applications for OS X.
Using Rails 3 and ActiveModel, I am unable to use the self. syntax to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.