PdfRpt.Core.Security.PfxReader.findThePublicKey C# (CSharp) Method

findThePublicKey() private static method

private static findThePublicKey ( Pkcs12Store pkcs12Store ) : string
pkcs12Store Org.BouncyCastle.Pkcs.Pkcs12Store
return string
        private static string findThePublicKey(Pkcs12Store pkcs12Store)
        {
            var alias = string.Empty;
            foreach (var entry in pkcs12Store.Aliases.Cast<string>().Where(entry => pkcs12Store.IsKeyEntry(entry) && pkcs12Store.GetKey(entry).Key.IsPrivate))
            {
                alias = entry;
                break;
            }

            if (string.IsNullOrEmpty(alias))
                throw new InvalidOperationException("Provided certificate is invalid.");

            return alias;
        }