TX509Certificate.SignCSR outputs a X509 certificate with missing data

Hello,

I played around with the demo application of TMS Cryptography pack. What I have done:

  1. Created a CA certificate. In "optional information" I checked the option CA (see picture)

  2. Created CSR:

  3. Signed the created CSR in 2. by the CA certificate in 1.

The result:

  1. The opened CA looks like this:

  1. The signed CSR looks like this. The issuer is missing, the signature is also missing.

When I am trying to open the signed CSR via ASN.1 Parser Online, it throws me an error:

Content size is not correct for container at offset 44

Via X509 Certificate Reader, Validation, Recovocation Checking and Conversion the signed CSR can not be opened neither.

My questions are:

  1. How to add the issuer to the signed CSR?
  2. How to add the signature?
  3. Why the signed CSR can not be opened by the online tools you have provided? Is that a bug?

And in general, is the signing process correct?

Thank you for your effort and help!

@wlandgraf Could you please move this ticket also to TMS Cryptography?

p.s. Currently I am evaluating the crypto pack trial version and face some issues. Why is it not possible to create topics directly in the TMS Cryptography category!?

Thanks for your help!

Because you are not a registered user.

That's because it is a self signed CSR.

To add the 'issuer' and 'issuer signature' requires the modification of the crt_request_RSA (and ECDSA) functions.

On question 3, I don't know, your example CSRs open well in all tools I have tested. There may be an issue with CRLF handling with some tools.

That's because it is a self signed CSR.

As far as I know, there is no such thing like "a self signed CSR". What exactly do you mean with "a self signed CSR"!? :thinking:

To add the 'issuer' and 'issuer signature' requires the modification of the crt_request_RSA (and ECDSA) functions

Would you please provide this functionality?

On question 3, I don't know, your example CSRs open well in all tools I have tested. There may be an issue with CRLF handling with some tools.

Please try the following:

  1. Generate via TX509CSR a new CSR
  2. Sign it via TX509Certificate.SignCsr
  3. Try to view the signed cert via openssl

Here is the code:

procedure TForm3.Button1Click(Sender: TObject);
begin
  X509CSR1.KeyFilePath := 'entity.key';
  X509CSR1.CSRFilePath := 'entity.csr';
  X509CSR1.signatureAlgorithm := TSignAlgo.sa_sha256rsa;
  X509CSR1.hashFunction := TX509HashFunction.sha256;
  X509CSR1.BitSizeEncryptionAlgorithm := 2048;
  X509CSR1.countryName := 'DE';
  X509CSR1.stateName := 'Berlin';
  X509CSR1.OrganizationName := 'Name';
  X509CSR1.OrganizationUnitName := 'Unit';
  X509CSR1.commonName := 'SomeValue';
  X509CSR1.SetVersion('1');
  X509CSR1.Generate;
end;

procedure TForm3.Button3Click(Sender: TObject);
begin
  X509Certificate1.KeyFilePath := 'rootCA.key';
  X509Certificate1.CrtFilePath := 'rootCA.crt';
  X509Certificate1.SignCSR(X509CSR1.CSRFilePath, 'SignedCert.crt');
end;

Here are the openssl outputs:

Noted. There is a bug in the version assignment and parsing and the current CSR has the same input for owner and issuer.
This will be fixed later on.

1 Like

This will be fixed later on.
Is there a timeline for this fix? Thank you!