Comments (8)
great, thanks for the update.
from certes.
Could you share the code or steps you used to generate the certificate?
from certes.
Sure. This is the part when I create the certificate:
`var csr = new CertificationRequestBuilder();
csr.AddName("CN", domains.First());
foreach (var alternativeName in domains.Skip(1))
csr.SubjectAlternativeNames.Add(alternativeName);
var cert = await client.NewCertificate(csr);
var friendlyName = domains.First();
friendlyName = friendlyName.Replace('.', '-');
var password = Membership.GeneratePassword(20, 4);
// Export Pfx
var pfxBuilder = cert.ToPfx();
var pfx = pfxBuilder.Build(friendlyName, password);
return new CertificatePfx
{
Domains = domains,
Data = pfx,
FriendlyName = friendlyName,
Password = password
};`
from certes.
Sorry about closing the issue. It's been a long week with this issue.
from certes.
Then I try to import the certificate on server:
var newCert = new X509Certificate2(pfx.Data, pfx.Password, X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.Exportable);
if (!newCert.Verify())
{
//throw new Exception("Certificate is not valid!");
}
using (var readWriteMyStore = new X509Store(StoreName.My, StoreLocation.CurrentUser))
{
readWriteMyStore.Open(OpenFlags.ReadWrite);
readWriteMyStore.Add(newCert);
readWriteMyStore.Close();
}
var serverManager = new ServerManager();
var site = serverManager.Sites[0];
var binding = site.Bindings.Add(":443:" + pfx.Domains.First(), newCert.GetCertHash(), "My");
binding.SetAttributeValue("sslFlags", 1); //enables the SNI
serverManager.CommitChanges();
from certes.
Have you try installing the pfx locally into MMC? Can you export it again with private key?
What happen if you bind the SSL manually?
from certes.
I've imported the pfx using the password and worked fine. I created the biding manually and it worked fine. I exported it to another pfx with a different password if this is what you mean.
from certes.
It might have been a settings issue when I was adding the biding. With this setting it works fine:
var newCert = new X509Certificate2(pfx.Data, pfx.Password, X509KeyStorageFlags.Exportable);
and also this:
var readWriteMyStore = new X509Store(StoreName.My, StoreLocation.LocalMachine)
Now it binds with no errors and it works fine.
from certes.
Related Issues (20)
- State of this project
- Async methods do not support cancellation
- Get System.NullReferenceException: 'Object reference not set to an instance of an object.' while creating new account HOT 1
- How to generate public and private keys HOT 3
- Confusion on base documentation HOT 16
- Latest stable build 3.0.4 tag? HOT 3
- CertificateInfo inaccessible
- There is no such function CertificateInfo
- Certes breaks when the default JsonSerializerSettings includes DefaultValueHandling.Ignore
- NewAccount HOT 3
- ZeroSSL
- Different line endings for certificate, certificate chain and private key
- Native AOT support HOT 5
- Upgrade to BouncyCastle.Cryptography HOT 1
- Planned changes to Lets Encrypt - short chain delivery HOT 7
- Error Accessing Existing Account HOT 1
- Unknown CertificateInfo Class
- Wildcard SAN challenge for the non-* HOT 1
- Version 3.0.4? HOT 5
- IAuthorizationContext.Http().Result returns Nothing if OrderName starts with wildcard HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from certes.