Search in sources :

Example 1 with SignatureAndHashAlgorithm

use of de.rub.nds.tlsattacker.core.constants.SignatureAndHashAlgorithm in project TLS-Scanner by RUB-NDS.

the class ProtocolVersionProbe method getTls13SignatureAndHashAlgorithms.

private List<SignatureAndHashAlgorithm> getTls13SignatureAndHashAlgorithms() {
    List<SignatureAndHashAlgorithm> algos = new LinkedList<>();
    algos.add(new SignatureAndHashAlgorithm(SignatureAlgorithm.RSA, HashAlgorithm.SHA256));
    algos.add(new SignatureAndHashAlgorithm(SignatureAlgorithm.RSA, HashAlgorithm.SHA384));
    algos.add(new SignatureAndHashAlgorithm(SignatureAlgorithm.RSA, HashAlgorithm.SHA512));
    algos.add(new SignatureAndHashAlgorithm(SignatureAlgorithm.ECDSA, HashAlgorithm.SHA256));
    algos.add(new SignatureAndHashAlgorithm(SignatureAlgorithm.ECDSA, HashAlgorithm.SHA384));
    algos.add(new SignatureAndHashAlgorithm(SignatureAlgorithm.ECDSA, HashAlgorithm.SHA512));
    algos.add(new SignatureAndHashAlgorithm(SignatureAlgorithm.RSA_PSS, HashAlgorithm.SHA256));
    algos.add(new SignatureAndHashAlgorithm(SignatureAlgorithm.RSA_PSS, HashAlgorithm.SHA384));
    algos.add(new SignatureAndHashAlgorithm(SignatureAlgorithm.RSA_PSS, HashAlgorithm.SHA512));
    return algos;
}
Also used : LinkedList(java.util.LinkedList) SignatureAndHashAlgorithm(de.rub.nds.tlsattacker.core.constants.SignatureAndHashAlgorithm)

Example 2 with SignatureAndHashAlgorithm

use of de.rub.nds.tlsattacker.core.constants.SignatureAndHashAlgorithm in project TLS-Scanner by RUB-NDS.

the class CertificateReportGenerator method setSignatureAndHashAlgorithm.

private static void setSignatureAndHashAlgorithm(CertificateReportImplementation report, org.bouncycastle.asn1.x509.Certificate cert) {
    String sigAndHashString = null;
    try {
        X509CertificateObject x509Cert = new X509CertificateObject(cert);
        sigAndHashString = x509Cert.getSigAlgName();
        if (sigAndHashString != null) {
            String[] algos = sigAndHashString.toUpperCase().split("WITH");
            if (algos.length != 2) {
                LOGGER.warn("Could not parse " + sigAndHashString + " into a reasonable SignatureAndHash algorithm");
                return;
            }
            SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.valueOf(algos[1]);
            HashAlgorithm hashAlgorithm = HashAlgorithm.valueOf(algos[0]);
            if (hashAlgorithm == null) {
                LOGGER.warn("Parsed an unknown HashAlgorithm");
                return;
            }
            if (signatureAlgorithm == null) {
                LOGGER.warn("Parsed an unknown SignatureAlgorithm");
                return;
            }
            SignatureAndHashAlgorithm sigHashAlgo = new SignatureAndHashAlgorithm(signatureAlgorithm, hashAlgorithm);
            report.setSignatureAndHashAlgorithm(sigHashAlgo);
        }
    } catch (Exception E) {
        LOGGER.debug("Could not extraxt SignatureAndHashAlgorithm from String:" + sigAndHashString, E);
    }
}
Also used : X509CertificateObject(org.bouncycastle.jce.provider.X509CertificateObject) SignatureAlgorithm(de.rub.nds.tlsattacker.core.constants.SignatureAlgorithm) CertificateParsingException(java.security.cert.CertificateParsingException) IOException(java.io.IOException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) SignatureAndHashAlgorithm(de.rub.nds.tlsattacker.core.constants.SignatureAndHashAlgorithm) HashAlgorithm(de.rub.nds.tlsattacker.core.constants.HashAlgorithm) SignatureAndHashAlgorithm(de.rub.nds.tlsattacker.core.constants.SignatureAndHashAlgorithm)

Aggregations

SignatureAndHashAlgorithm (de.rub.nds.tlsattacker.core.constants.SignatureAndHashAlgorithm)2 HashAlgorithm (de.rub.nds.tlsattacker.core.constants.HashAlgorithm)1 SignatureAlgorithm (de.rub.nds.tlsattacker.core.constants.SignatureAlgorithm)1 IOException (java.io.IOException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 CertificateParsingException (java.security.cert.CertificateParsingException)1 LinkedList (java.util.LinkedList)1 X509CertificateObject (org.bouncycastle.jce.provider.X509CertificateObject)1