Questions tagged [x509certificate2]

.NET Class for handling X.509 Certificates

922 questions
6
votes
1 answer

Adding a Digital signature to a PDF with iTextSharp

Background I have been using iTextSharp for a short while now. I have created a pdf document with two signable PdfFormFields. If I open the pdf document I can manually sign each field manually. I want this to be done through iTextSharp. I am…
6
votes
2 answers

Add a generated certificate to the store and update an IIS site binding

I'm running into the following and after feeling like I've exhausted various avenues of research on Google and Stack Overflow I decided to just ask my own question about it. I'm trying to generate a personal certificate (using BouncyCastle) based on…
Fizz
  • 3,427
  • 4
  • 27
  • 43
6
votes
1 answer

Exception on attempt to create not self-signed certificate

I want to switch from self-signed certificate per device to pair of certificates, one of which is previously generated, placed in Trusted Root Certificate Authorities store, is same for all devices, and works as root CA for second certificate, which…
lentinant
  • 792
  • 1
  • 10
  • 36
6
votes
2 answers

How can I encrypt, decrypt and sign using .pfx certificate?

I have a .pfx certificate file on my computer. I want to to encrypt a message with its public key, and then decrypt it with the private. Also I want to sign another message with its private key, and then check the signature. And I need to get the…
AlexAlum
  • 347
  • 1
  • 9
  • 19
6
votes
2 answers

Unable to decode certificate at client new X509Certificate2()

I'm using this little class which returns me a pfx file in byte array. Server side: byte[] serverCertificatebyte; var date = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day); serverCertificatebyte =…
DreTaX
  • 760
  • 2
  • 9
  • 22
6
votes
1 answer

How do I view "Signature hash algorithm" in C# certificate callback?

I have a server that uses the following certificate for SSL/TLS communications: In my C# code, I use a custom certificate validation callback to view the properties of this certificate programmatically, like so: private static bool…
Ryan Ries
  • 2,381
  • 1
  • 24
  • 33
6
votes
2 answers

Create and verify x509 certificates in .Net

In connection with my enterprise project (intranet only) I came across a question with the verification of certificates using .net System.Security.Cryptography.X509Certificates Step 1: Creating a root certificate Use makecert to create a root…
achibus
  • 126
  • 1
  • 7
6
votes
2 answers

How to encrypt/decrypt text using a X509Certificate & AES-256 algorithm

I have a X509 certificate that I would like to use to encrypt/decrypt password. However, I can only use AES-256 algorithm. Everything I have found on the internet suggests to use RSACryptoServiceProvider, but that does not do AES-256 encryption. I…
Skadoosh
  • 2,575
  • 8
  • 40
  • 53
6
votes
1 answer

Given two certificates, how can I verify that one was signed with the other's private key?

I have two X509Certificate2s. Call them toCheck and checkWith. How can I check that toCheck was signed by the private key of checkWith? Basically, I want the C# equivalent of Java's toCheck.verify(checkWith.getPublicKey()); Thanks
Eric
  • 4,201
  • 5
  • 27
  • 36
6
votes
2 answers

https using BasicHttpBinding and ignoring certificate errors

I am using BasicHttpBinding to connect a web service hosted on a secured (https) port. To get it working, I have changed the Security.Mode to TransportWithMessageCredential and Security.Message to BasicHttpMessageCredentialType.Cerificate. I am…
Venkatesh Laguduva
  • 13,448
  • 6
  • 33
  • 45
6
votes
1 answer

X509Certificate2.Verify() method, validating against revocation list and performance implications of it

I want to validate the X509 certificate. And I thought to go for X509Certificate2.Verify() method. However, the documentation does not tell anything about what all things it verifies. Please direct me to some documentation which provides details…
Learner
  • 4,661
  • 9
  • 56
  • 102
5
votes
1 answer

Can any tell me the difference between CSR version and certificate version?

I want to generate a X509 v3 certificate using a CSR (RFC2986), but the RFC says PKCS10 (CSR) supports only v1. Can anyone tell me the difference?
Balamurugan
  • 2,259
  • 8
  • 33
  • 48
5
votes
1 answer

Get PEM public and private keys or from PFX file

I have a PEM file that was generated with openssl using the following command: .\openssl.exe pkcs12 -in "C:\temp\mytest.pfx" -nokeys -out "C:\temp\mytest.publicchain.pem" This generated a PEM file with the following content: -----BEGIN…
Vivendi
  • 20,047
  • 25
  • 121
  • 196
5
votes
1 answer

C# signature verification using ECDSA with SHA256 certificate

I'm trying to use C# and the built in Crypto libraries to verify a signature created using an EC key + SHA256. Here's what I'm doing. I've created a private key and corresponding certificate using openssl: $ openssl ecparam -genkey -name prime256v1…
Amr Bekhit
  • 4,613
  • 8
  • 34
  • 56
5
votes
1 answer

Unable to add key file to X509Certificate2

Environment: VS 2019, Core 3.1, C# 8.0 I'm getting the following error while trying to add a .cer and .key file to my httpClientHandler: {"ASN1 corrupted data."} Data: {System.Collections.ListDictionaryInternal} HResult:…
MyDisplayName
  • 223
  • 5
  • 12