Forum Discussion

xmoncomble's avatar
xmoncomble
Copper Contributor
Jan 04, 2021

Register a virtual printer : parameter certificateSigningRequest

on my web application, I would like to Register one or more virtual printers (https://docs.microsoft.com/fr-fr/graph/universal-print-concept-overview part Extending Universal Print to support pull printing) with the API print/printers/create but I need to add on the body the certificateSigningRequest parameter and i don't understand how to do that

HOW to generate the content and transportKey ?

 

 

 

 

 

2 Replies

  • mwetzko's avatar
    mwetzko
    Copper Contributor

    xmoncomble 

    You can do that with dotnet:

     

    // dotnet 5.0
    using System;
    using System.Security.Cryptography;
    using System.Security.Cryptography.X509Certificates;
    
    RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(2048);
    
    CertificateRequest certificateRequest = new CertificateRequest("CN=My Name", rsa, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1);
    certificateRequest.CertificateExtensions.Add(new X509KeyUsageExtension(X509KeyUsageFlags.DigitalSignature, false));
    
    var Content = Convert.ToBase64String(certificateRequest.CreateSigningRequest());
    var TransportKey = Convert.ToBase64String(rsa.ExportRSAPublicKey());

     

    Of course: the usings on top and the code inside some method.

Resources