<commit_before>﻿// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
namespace IdentityServer3.Contrib.Vault.CertificateStore.Helpers
{
    using System.Security.Cryptography;
    using Interfaces;
    using Org.BouncyCastle.Asn1;
    using Org.BouncyCastle.Asn1.Pkcs;
    using Org.BouncyCastle.Security;

    class RsaCryptoServiceProviderHelper : IRSACryptoServiceProviderHelper
    {
        /// <summary>Get the Private Key Provider from the Vault Private Key</summary>
        /// <param name="privateKeyData">Private Key Data</param>
        /// <returns>RSA Crypto Service Provider</returns>
        public RSACryptoServiceProvider GetPrivateKeyProvider(byte[] privateKeyData)
        {
            var stream = new Asn1InputStream(privateKeyData).ReadObject();
            var privateKeyStructure = RsaPrivateKeyStructure.GetInstance(stream);
            var rsaParameters = DotNetUtilities.ToRSAParameters(privateKeyStructure);

            var cspParameters = new CspParameters
            {
                KeyContainerName = Constants.PrivateKeyContainerName<commit_msg>Made the RSACryptoServiceProviderHelper class public<commit_after>﻿// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
namespace IdentityServer3.Contrib.Vault.CertificateStore.Helpers
{
    using System.Security.Cryptography;
    using Interfaces;
    using Org.BouncyCastle.Asn1;
    using Org.BouncyCastle.Asn1.Pkcs;
    using Org.BouncyCastle.Security;

    public class RsaCryptoServiceProviderHelper : IRSACryptoServiceProviderHelper
    {
        /// <summary>Get the Private Key Provider from the Vault Private Key</summary>
        /// <param name="privateKeyData">Private Key Data</param>
        /// <returns>RSA Crypto Service Provider</returns>
        public RSACryptoServiceProvider GetPrivateKeyProvider(byte[] privateKeyData)
        {
            var stream = new Asn1InputStream(privateKeyData).ReadObject();
            var privateKeyStructure = RsaPrivateKeyStructure.GetInstance(stream);
            var rsaParameters = DotNetUtilities.ToRSAParameters(privateKeyStructure);

            var cspParameters = new CspParameters
            {
                KeyContainerName = Constants.PrivateKeyContainerName
{'fraction_non_alphanumeric': 0.07808764940239044, 'fraction_numerical': 0.006374501992031873, 'mean_word_length': 3.227272727272727, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2897962', 'n_tokens_mistral': 695, 'n_tokens_neox': 673, 'n_words': 180}