Beispiel #1
0
        public bool IsVulnerableToROCA(Pkcs11CertificateInfo certificateInfo)
        {
            X509CertificateParser x509CertificateParser = new X509CertificateParser();
            X509Certificate       x509Certificate       = x509CertificateParser.ReadCertificate(certificateInfo.CkaValue);
            RsaKeyParameters      rsaKeyParameters      = x509Certificate.GetPublicKey() as RsaKeyParameters;

            return(RocaVulnerabilityTester.IsVulnerable(rsaKeyParameters));
        }
Beispiel #2
0
        public bool IsVulnerableToROCA(Pkcs11KeyInfo keyInfo)
        {
            RsaKeyParameters rsaKeyParameters = null;

            if (keyInfo.CkaClass == (ulong)CKO.CKO_PRIVATE_KEY && keyInfo.CkaKeyType == (ulong)CKK.CKK_RSA)
            {
                rsaKeyParameters = GetPubKeyParams(keyInfo, null) as RsaKeyParameters;
            }
            else if (keyInfo.CkaClass == (ulong)CKO.CKO_PUBLIC_KEY && keyInfo.CkaKeyType == (ulong)CKK.CKK_RSA)
            {
                rsaKeyParameters = GetPubKeyParams(null, keyInfo) as RsaKeyParameters;
            }
            else
            {
                throw new Exception("Unsupported key type");
            }

            return(RocaVulnerabilityTester.IsVulnerable(rsaKeyParameters));
        }