Example source to create/request SSL Certs - WeOnlyDo Discussion board

Example source to create/request SSL Certs (wodWebServer / wodWebServer.NET)

by Chris, Thursday, October 07, 2004, 10:35 (7352 days ago)

Hi

Is it possible for you to post some examples on creating and generating certificate requests.

For example, to be able to enter Common Name, Bit count, Department, valid from, valid to. Have an option to generate the test certificate files like the ones you include in the distro but also to generate the request code to be sent to the CA?

Re: Example source to create/request SSL Certs

by wodSupport, Friday, October 08, 2004, 03:19 (7351 days ago) @ Chris

Chris,

you can use code like this:

[code] Dim cert As New Certificate

cert.GenerateKey 0
cert.CommonName = www.weonlydo.com
cert.Country = US
cert.Email = test@weonlydo.com
cert.ValidFrom = Now
cert.ValidTo = Now + 365
cert.Generate

cert.SaveKey App.Path & cert.key
cert.Save App.Path & cert.cer
[/code]

to generate request instead, use
[code]cert.Request app.Path & cert.req [/code]

Does this help?

Re: Example source to create/request SSL Certs

by chris, Sunday, October 17, 2004, 21:10 (7342 days ago) @ wodSupport

Many thanks, this worked fine.

Re: Example source to create/request SSL Certs

by chris, Wednesday, October 27, 2004, 11:21 (7332 days ago) @ chris

Chris,

I suggest you use Certificate.Export method. You will create PFX file which you can double-click on and install into windows registry.

Can you try that?

Re: Example source to create/request SSL Certs

by chris, Wednesday, October 27, 2004, 14:50 (7332 days ago) @ chris

Chris,

I suggest you use Certificate.Export method. You will create PFX file which you can double-click on and install into windows registry.

Can you try that?

Re: Example source to create/request SSL Certs

by Chris, Wednesday, October 27, 2004, 15:21 (7332 days ago) @ chris

Hi again...

Using the example, I created and loaded the .pfx which worked fine but when trying to display the Friendly Name , the cert.friendlyname is blank eventhough is shown in the same field when displaying the certificate. Bug?

Re: Example source to create/request SSL Certs

by wodSupport, Wednesday, October 27, 2004, 15:43 (7332 days ago) @ Chris

Chris,

I am not 100 correct, but I think that what we call as 'Friendly name' is not the same as what IE calls with the same name. Even more - I think in IE you can change this value (and you cannot change certificate internally, of course), so it's possible IE actually stores this information somewhere else - for his own purpose.

Re: Example source to create/request SSL Certs

by amirsky, Tuesday, March 16, 2010, 09:44 (5366 days ago) @ wodSupport

Silly question form the new guy,

I have wodwebserver and wodHTTPDLX, but (using vb.net) i try the code same above I get for:

Dim cert As New Certificate

Error: Type 'Certificate' not defined.

The answer is probably super basic.

Re: Example source to create/request SSL Certs

by woddrazen, Tuesday, March 16, 2010, 09:57 (5366 days ago) @ amirsky

Hi,

First you should add Weonlydo Certificate Management library COM reference to your project.

Then you can try something like this:
[code]Dim cert As WODCERTMNGLib.Certificate
cert = New WODCERTMNGLib.Certificate

cert.Load( c:\private.txt , password )[/code]
Hope this helps.


Regards,
Drazen

Re: Example source to create/request SSL Certs

by amirsky, Tuesday, March 16, 2010, 13:56 (5366 days ago) @ woddrazen

Thanks for the response. Got that working but my current issue is that i am trying to follow the instructions given by an SSL provider. This what they require, how can i print out that sample they they give below?:

(Quoted)

You must generate a Certificate Signing Request (CSR) on your webserver. Click here for help generating your CSR. When you have created your CSR you may continue with the enrollment.

NOTE: Please ensure that the Common Name (CN) in your CSR is ONE of the following:

* your Fully Qualified Domain Name (e.g. secure.yourdomain.com )
* the Full Server Name of your internal server (e.g. techserver )
* your Private IP address (e.g. 192.168.0.1 )

After you have generated a CSR using your server software copy and paste the CSR text using an ASCII text editor into the CSR box below. Your CSR should look something like this:

-----BEGIN CERTIFICATE REQUEST-----
MIIDUDCCArkCAQAwdTEWMBQGA1UEAxMNdGVzdC50ZXN0LmNvbTESMBAGA1UECxMJ
TWFya2V0aW5nMREwDwYDVQQKEwhUZXN0IE9yZzESMBAGA1UEBxMJVGVzdCBDaXR5
(more encoded data).......
Rq+blLr5X5iQdzyF1pLqP1Mck5Ve1eCz0R9/OekGSRno7ow4TVyxAF6J6ozDaw7e
GisfZw40VLT0/6IGvK2jX0i+t58RFQ8WYTOcTRlPnkG8B/uV
-----END CERTIFICATE REQUEST-----

Re: Example source to create/request SSL Certs

by woddrazen, Tuesday, March 16, 2010, 14:33 (5366 days ago) @ amirsky

Hi,


In order to make certificate request you should use Request Method in wodCertificate. Request will be saved in file. You can then send it to certificate authority and ask for valid certificate.

You can specify Common Name inside CommonName Property.
[code] Dim cert As WODCERTMNGLib.Certificate
cert = New WODCERTMNGLib.Certificate

cert.GenerateKey(0) 'key type, RSA or DSA
cert.CommonName = CN - your domain or server name
cert.Country = US
cert.Email = you@yourdomain.com
cert.Locality = your_country
cert.Organization = your company name
cert.State = your_state
cert.ValidFrom = 'date that certificate will be valid from
cert.ValidTo = 'date that certificate will expire

cert.Request( C:\request.csr )[/code]
More help for Request Method you can find here:
http://www.weonlydo.com/CertMng/Help/WODCERTMNGLib~Certificate~Request.html


Drazen