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

  • Home
  • SEARCH
  • 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 6959509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:16:52+00:00 2026-05-27T15:16:52+00:00

In Java, I tried to sign a byte[] (which is my sha256 digest of

  • 0

In Java, I tried to sign a byte[] (which is my sha256 digest of my document) with bouncy castle and a certificate in this specification:

http://www.ebics.org/fileadmin/unsecured/specification/spec_current_EN/EBICS_Specification_2.5_final-16-05-2011.pdf

in chapter 14.1.4.1.1 Digital signature generation.

I found in bouncy’s java doc this method:

public static byte[] signer(byte[] datas, Certificat cert) {
    try {
        List<X509Certificate> certList = new ArrayList<X509Certificate>();
        CMSTypedData msg = new CMSProcessableByteArray(datas);

        certList.add(cert.getCertificat());

        Store certs = new JcaCertStore(certList);

        CMSSignedDataGenerator gen = new CMSSignedDataGenerator();
        ContentSigner sha256signer = new JcaContentSignerBuilder(
                "SHA256withRSA").setProvider("BC").build(
                cert.getPrivateKey());

        gen.addSignerInfoGenerator(new JcaSignerInfoGeneratorBuilder(
                new JcaDigestCalculatorProviderBuilder().setProvider("BC")
                        .build()).build(sha256signer, cert.getCertificat()));

        gen.addCertificates(certs);

        CMSSignedData sigData = gen.generate(msg, true);
        return sigData.getEncoded();
    } 
    catch (Exception e) {
        throw new RuntimeException(
                "Erreur lors de la signature du document", e);
    }

I don’t know if this signature is really in accordance with PKCS#1 1.5 required by the specification. Do I have to add the padding manually? And the OID for RSA256?

  • 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-05-27T15:16:53+00:00Added an answer on May 27, 2026 at 3:16 pm

    EBICS signature A005 is a RSA signature with SHA-256 digest algorithm and PKCS#1 1.5 padding. However the code sample you pasted here is creating a CMS signature which uses a “low level” RSA signature but is a much more complex structure (for comprehensive details, see RFC 5652 http://www.rfc-editor.org/rfc/rfc5652.txt).

    Hopefully, generating the signature you are trying to get is really simple with the java crypto API:

    public static byte[] signer(byte[] data, PrivateKey key) {
        Signature signer = Signature.getInstance("SHA256WithRSA", "BC");
        signer.initSign(key);
        signer.update(data);
        return signer.sign();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried decompiling a Java application to which I do not have the source
I found a sat solver in http://code.google.com/p/aima-java/ I tried the following code to solve
Has anyone tried automatic Java to C++ conversion for speed improvements? Is it a
I've seen some code such as: out.println(print something); I tried import java.lang.System; but it's
I tried writing a program in Java using regex to match a pattern and
I have tried several ways to login to a website through java. I have
I am new to java and jboss I tried these commands on my Centos5.4
I've written a Java applet . A user reports that he tried to run
I have tried &nbsp;&nbsp; to display two spaces in a standard output Java String.
Is there an equivalent to the Java File method isDirectory() in MFC? I tried

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.