@Test(expected = UnsupportedOperationException.class) public void testGetDigestUnsupportedProtocolVersionSSL2() { AlgorithmResolver.getDigestAlgorithm(ProtocolVersion.SSL2, CipherSuite.TLS_FALLBACK_SCSV); }
public static DigestAlgorithm getDigestAlgorithm(ProtocolVersion protocolVersion, CipherSuite cipherSuite) { DigestAlgorithm result; if (protocolVersion == ProtocolVersion.SSL3 || protocolVersion == ProtocolVersion.SSL2) { throw new UnsupportedOperationException("SSL3 and SSL2 PRF currently not supported"); } if (cipherSuite.usesGOSTR3411()) { result = DigestAlgorithm.GOSTR3411; } else if (cipherSuite.usesGOSTR34112012()) { result = DigestAlgorithm.GOSTR34112012_256; } else if (protocolVersion == ProtocolVersion.TLS10 || protocolVersion == ProtocolVersion.TLS11 || protocolVersion == ProtocolVersion.DTLS10) { result = DigestAlgorithm.LEGACY; } else if (cipherSuite.usesSHA384()) { result = DigestAlgorithm.SHA384; } else { result = DigestAlgorithm.SHA256; } LOGGER.debug("Using the following Digest Algorithm: {}", result); return result; }
AlgorithmResolver { public static DigestAlgorithm getDigestAlgorithm(ProtocolVersion protocolVersion, CipherSuite cipherSuite) { DigestAlgorithm result; if (protocolVersion == ProtocolVersion.SSL3 || protocolVersion == ProtocolVersion.SSL2) { throw new UnsupportedOperationException("SSL3 and SSL2 PRF currently not supported"); } if (cipherSuite.usesGOSTR3411()) { result = DigestAlgorithm.GOSTR3411; } else if (cipherSuite.usesGOSTR34112012()) { result = DigestAlgorithm.GOSTR34112012_256; } else if (protocolVersion == ProtocolVersion.TLS10 || protocolVersion == ProtocolVersion.TLS11 || protocolVersion == ProtocolVersion.DTLS10) { result = DigestAlgorithm.LEGACY; } else if (cipherSuite.usesSHA384()) { result = DigestAlgorithm.SHA384; } else { result = DigestAlgorithm.SHA256; } LOGGER.debug("Using the following Digest Algorithm: {}", result); return result; } }
AlgorithmResolver { public static DigestAlgorithm getDigestAlgorithm(ProtocolVersion protocolVersion, CipherSuite cipherSuite) { DigestAlgorithm result; if (protocolVersion == ProtocolVersion.SSL3 || protocolVersion == ProtocolVersion.SSL2) { throw new UnsupportedOperationException("SSL3 and SSL2 PRF currently not supported"); } if (cipherSuite.usesGOSTR3411()) { result = DigestAlgorithm.GOSTR3411; } else if (cipherSuite.usesGOSTR34112012()) { result = DigestAlgorithm.GOSTR34112012_256; } else if (protocolVersion == ProtocolVersion.TLS10 || protocolVersion == ProtocolVersion.TLS11 || protocolVersion == ProtocolVersion.DTLS10) { result = DigestAlgorithm.LEGACY; } else if (cipherSuite.usesSHA384()) { result = DigestAlgorithm.SHA384; } else { result = DigestAlgorithm.SHA256; } LOGGER.debug("Using the following Digest Algorithm: {}", result); return result; } private  AlgorithmResolver(); }
AlgorithmResolver { public static DigestAlgorithm getDigestAlgorithm(ProtocolVersion protocolVersion, CipherSuite cipherSuite) { DigestAlgorithm result; if (protocolVersion == ProtocolVersion.SSL3 || protocolVersion == ProtocolVersion.SSL2) { throw new UnsupportedOperationException("SSL3 and SSL2 PRF currently not supported"); } if (cipherSuite.usesGOSTR3411()) { result = DigestAlgorithm.GOSTR3411; } else if (cipherSuite.usesGOSTR34112012()) { result = DigestAlgorithm.GOSTR34112012_256; } else if (protocolVersion == ProtocolVersion.TLS10 || protocolVersion == ProtocolVersion.TLS11 || protocolVersion == ProtocolVersion.DTLS10) { result = DigestAlgorithm.LEGACY; } else if (cipherSuite.usesSHA384()) { result = DigestAlgorithm.SHA384; } else { result = DigestAlgorithm.SHA256; } LOGGER.debug("Using the following Digest Algorithm: {}", result); return result; } private  AlgorithmResolver(); static PRFAlgorithm getPRFAlgorithm(ProtocolVersion protocolVersion, CipherSuite cipherSuite); static DigestAlgorithm getDigestAlgorithm(ProtocolVersion protocolVersion, CipherSuite cipherSuite); static KeyExchangeAlgorithm getKeyExchangeAlgorithm(CipherSuite cipherSuite); static Set<PublicKeyAlgorithm> getRequiredKeystoreAlgorithms(CipherSuite cipherSuite); static CipherAlgorithm getCipher(CipherSuite cipherSuite); static BulkCipherAlgorithm getBulkCipherAlgorithm(CipherSuite cipherSuite); static CipherType getCipherType(CipherSuite cipherSuite); static MacAlgorithm getMacAlgorithm(ProtocolVersion protocolVersion, CipherSuite cipherSuite); static HKDFAlgorithm getHKDFAlgorithm(CipherSuite cipherSuite); }
AlgorithmResolver { public static DigestAlgorithm getDigestAlgorithm(ProtocolVersion protocolVersion, CipherSuite cipherSuite) { DigestAlgorithm result; if (protocolVersion == ProtocolVersion.SSL3 || protocolVersion == ProtocolVersion.SSL2) { throw new UnsupportedOperationException("SSL3 and SSL2 PRF currently not supported"); } if (cipherSuite.usesGOSTR3411()) { result = DigestAlgorithm.GOSTR3411; } else if (cipherSuite.usesGOSTR34112012()) { result = DigestAlgorithm.GOSTR34112012_256; } else if (protocolVersion == ProtocolVersion.TLS10 || protocolVersion == ProtocolVersion.TLS11 || protocolVersion == ProtocolVersion.DTLS10) { result = DigestAlgorithm.LEGACY; } else if (cipherSuite.usesSHA384()) { result = DigestAlgorithm.SHA384; } else { result = DigestAlgorithm.SHA256; } LOGGER.debug("Using the following Digest Algorithm: {}", result); return result; } private  AlgorithmResolver(); static PRFAlgorithm getPRFAlgorithm(ProtocolVersion protocolVersion, CipherSuite cipherSuite); static DigestAlgorithm getDigestAlgorithm(ProtocolVersion protocolVersion, CipherSuite cipherSuite); static KeyExchangeAlgorithm getKeyExchangeAlgorithm(CipherSuite cipherSuite); static Set<PublicKeyAlgorithm> getRequiredKeystoreAlgorithms(CipherSuite cipherSuite); static CipherAlgorithm getCipher(CipherSuite cipherSuite); static BulkCipherAlgorithm getBulkCipherAlgorithm(CipherSuite cipherSuite); static CipherType getCipherType(CipherSuite cipherSuite); static MacAlgorithm getMacAlgorithm(ProtocolVersion protocolVersion, CipherSuite cipherSuite); static HKDFAlgorithm getHKDFAlgorithm(CipherSuite cipherSuite);  }