<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Devprime | Documentation – Data Protection</title>
    <link>https://docs.Devprime.io/examples/security/data-protection/</link>
    <description>Recent content in Data Protection on Devprime | Documentation</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    
	  <atom:link href="https://docs.Devprime.io/examples/security/data-protection/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Examples: Creating a Certificate</title>
      <link>https://docs.Devprime.io/examples/security/data-protection/certificates/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>https://docs.Devprime.io/examples/security/data-protection/certificates/</guid>
      <description>
        
        
        &lt;p&gt;To enable the operation, it is necessary to create a certificate either by Windows / Linux / Mac and share it among all the replicas of the microservice. This sharing will ensure that a request that is being processed through one instance can continue on the other.&lt;/p&gt;
&lt;h3 id=&#34;creating-the-certificate-in-windows&#34;&gt;Creating the certificate in windows&lt;/h3&gt;
&lt;p&gt;For the creation of the certificate we will use the local folder (c:\temp\ssl) and the Windows Terminal / PowerShell tool that must be initialized in administrator mode before executing the commands below.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Run the powershell command to create a new certificate&lt;/li&gt;
&lt;/ol&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;New-SelfSignedCertificate -Type Custom -Subject &amp;#34;CN=TokenSigningForDataProtection&amp;#34; -TextExtension @(&amp;#34;2.5.29.37={text}1.3.6.1.5.5.7.3.3&amp;#34;) -KeyUsage DigitalSignature -KeyAlgorithm RSA  -KeyLength 2048 -CertStoreLocation &amp;#34;Cert:\LocalMachine\My&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You will have something like this:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;
&lt;table style=&#34;border-spacing:0;padding:0;margin:0;border:0;&#34;&gt;&lt;tr&gt;&lt;td style=&#34;vertical-align:top;padding:0;margin:0;border:0;&#34;&gt;
&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code&gt;&lt;span style=&#34;white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34;&gt;1
&lt;/span&gt;&lt;span style=&#34;white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34;&gt;2
&lt;/span&gt;&lt;span style=&#34;white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34;&gt;3
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td style=&#34;vertical-align:top;padding:0;margin:0;border:0;;width:100%&#34;&gt;
&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Thumbprint                                Subject
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;----------                                -------
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;5C9A0067427FEE4E66D33761D04BC7F36064DA87  CN=TokenSigningForDataProtection
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;ol start=&#34;2&#34;&gt;
&lt;li&gt;Copy the value of the Thumbprint and use it in the &lt;em&gt;Thumbprint&lt;/em&gt; field and then set a new password for use in the &lt;em&gt;Password&lt;/em&gt; field.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;$cert = (Get-ChildItem -Path cert:\LocalMachine\My&amp;lt;Thumbprint&amp;gt;)&lt;br&gt;
$mypwd = ConvertTo-SecureString -String &amp;ldquo;&lt;Password&gt;&amp;rdquo; -Force -AsPlainText&lt;/p&gt;
&lt;p&gt;&lt;em&gt;The password provided above will be used to configure the certificate in the Cluster.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$cert = (Get-ChildItem -Path cert:\LocalMachine\My\5C9A0067427FEE4E66D33761D04BC7F36064DA87)
$mypwd = ConvertTo-SecureString -String &amp;#34;@mypaswrodk76&amp;#34; -Force -AsPlainText
&lt;/code&gt;&lt;/pre&gt;&lt;ol start=&#34;3&#34;&gt;
&lt;li&gt;Run the command below using the same Thumbprint as before&lt;br&gt;
Get-ChildItem -Path cert:\localMachine\my&amp;lt;Thumbprint&amp;gt; | Export-PfxCertificate -FilePath C:\temp\ssl\certificate.pfx -password $mypwd&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Get-ChildItem -Path cert:\localMachine\my\5C9A0067427FEE4E66D33761D04BC7F36064DA87 | Export-PfxCertificate -FilePath C:\temp\ssl\certificate.pfx -Password $mypwd
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;After running this command you will have a new SSL file in the C:\temp\ssl folder and it can be copied&lt;br&gt;
to a shared storage in the Kubernetes Cluster.&lt;/p&gt;
&lt;ol start=&#34;4&#34;&gt;
&lt;li&gt;Verifying the validity of the previously created certificate&lt;br&gt;
a) Install the package manager &lt;a href=&#34;https://chocolatey.org&#34;&gt;https://chocolatey.org&lt;/a&gt;&lt;br&gt;
b) Open a prompt as an administrator and install OpenSSL&lt;br&gt;
choco install openssl&lt;br&gt;
c) Close the windows terminal and then open it again&lt;br&gt;
d) Enter the folder where you generated the certificate (C:\temp\ssl)&lt;br&gt;
openssl PKCS12 -clcerts -nodes -in .\certificate.pfx | openssl x509 -noout -enddate&lt;br&gt;
e) Enter the password of the certificate and you will see the validity of the certificate&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Next steps:&lt;br&gt;
a) Create a Storage in the Cluster&lt;br&gt;
b) Modify the POD deployment by mounting the volume&lt;br&gt;
c) Copy the certificate to Storage&lt;br&gt;
d) Modify the Devprime Security setting to inform the path of the certificate in the cluster.&lt;/p&gt;
&lt;p&gt;To learn more:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://learn.microsoft.com/en-us/aspnet/core/security/data-protection/introduction&#34;&gt;ASP.NET Core Data Protection&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
  </channel>
</rss>
