You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
starting from the version 2.3.0 (last working version 2.2.1) spaces are removed from the beginning of the Common Name (X509Name). I don't know if this change is intentional but a bunch of our logic requires spaces at the beginning of the common name for padding purposes.
Current behavior: "CN= Test" becomes "CN=Test" in the certificate
Expected behavior: "CN= Test" stays "CN= Test"
Could you restore previous space handling behavior?
Thanks in advance
Demo:
publicstaticvoidMain(){conststringcommonName="CN= Test";// Common Name with space at the beginningvarkeyPairGenerator=newRsaKeyPairGenerator();keyPairGenerator.Init(newKeyGenerationParameters(newSecureRandom(),2048));AsymmetricCipherKeyPairkeyPair=keyPairGenerator.GenerateKeyPair();vargen=newX509V3CertificateGenerator();varCN=newX509Name(commonName);gen.SetSubjectDN(CN);gen.SetIssuerDN(CN);gen.SetSerialNumber(Org.BouncyCastle.Math.BigInteger.One);gen.SetNotBefore(DateTime.UtcNow.Date);gen.SetNotAfter(DateTime.UtcNow.Date.AddYears(1));gen.SetPublicKey(keyPair.Public);varsignatureFactory=newAsn1SignatureFactory("SHA256WithRSA",keyPair.Private);varcertificate=gen.Generate(signatureFactory);// Check if Common Name is correctif(certificate.SubjectDN.ToString()!=commonName){thrownewException($"Incorrect common name, expected {commonName}, got {certificate.SubjectDN}");}}
The text was updated successfully, but these errors were encountered:
Hello,
starting from the version 2.3.0 (last working version 2.2.1) spaces are removed from the beginning of the Common Name (X509Name). I don't know if this change is intentional but a bunch of our logic requires spaces at the beginning of the common name for padding purposes.
Current behavior: "CN= Test" becomes "CN=Test" in the certificate
Expected behavior: "CN= Test" stays "CN= Test"
Could you restore previous space handling behavior?
Thanks in advance
Demo:
The text was updated successfully, but these errors were encountered: