public boolean isEC() { return this.name().contains("EC"); }
public boolean isAnon() { return this.name().contains("ANON"); } }
public static byte[] generateSignature(PrivateKey key, byte[] toBeSigned, SignatureAndHashAlgorithm algorithm, BadRandom random, Chooser chooser) throws CryptoException { String algoName; if (chooser.getSelectedProtocolVersion() == ProtocolVersion.SSL3 || chooser.getSelectedProtocolVersion() == ProtocolVersion.TLS10 || chooser.getSelectedProtocolVersion() == ProtocolVersion.TLS11) { if (AlgorithmResolver.getKeyExchangeAlgorithm(chooser.getSelectedCipherSuite()).name().contains("RSA")) { algoName = "NONEwithRSA"; toBeSigned = ArrayConverter.concatenate(MD5Utils.MD5(toBeSigned), SHA1Utils.sha1(toBeSigned)); } else if (AlgorithmResolver.getKeyExchangeAlgorithm(chooser.getSelectedCipherSuite()).name() .contains("ECDSA")) { algoName = "SHA1withECDSA"; } else { throw new UnsupportedOperationException("Ciphersuite not supported - Check Debug Log"); } } else { algoName = algorithm.getJavaName(); } try { LOGGER.trace("Creating Signature with " + algoName + " over " + ArrayConverter.bytesToHexString(toBeSigned) + " with the PrivateKey:" + key.toString()); Signature instance = Signature.getInstance(algoName); instance.initSign(key, random); instance.update(toBeSigned); return instance.sign(); } catch (SignatureException | InvalidKeyException | NoSuchAlgorithmException ex) { throw new CryptoException("Could not sign Data", ex); } }
for (CipherSuite suite : config.getDefaultClientSupportedCiphersuites()) { KeyExchangeAlgorithm keyExchangeAlgorithm = AlgorithmResolver.getKeyExchangeAlgorithm(suite); if (keyExchangeAlgorithm != null && keyExchangeAlgorithm.name().toUpperCase().contains("EC")) { containsEc = true; break;
for (CipherSuite suite : config.getDefaultClientSupportedCiphersuites()) { KeyExchangeAlgorithm keyExchangeAlgorithm = AlgorithmResolver.getKeyExchangeAlgorithm(suite); if (keyExchangeAlgorithm != null && keyExchangeAlgorithm.name().toUpperCase().contains("EC")) { containsEc = true; break;
/** * * @return */ @Override public Config createConfig() { Config config = super.createConfig(); config.setAddRenegotiationInfoExtension(true); config.setAddServerNameIndicationExtension(true); config.setAddSignatureAndHashAlgorithmsExtension(true); config.setQuickReceive(true); config.setStopActionsAfterFatal(true); config.setStopRecievingAfterFatal(true); config.setEarlyStop(true); boolean containsEc = false; for (CipherSuite suite : config.getDefaultClientSupportedCiphersuites()) { KeyExchangeAlgorithm keyExchangeAlgorithm = AlgorithmResolver.getKeyExchangeAlgorithm(suite); if (keyExchangeAlgorithm != null && keyExchangeAlgorithm.name().toUpperCase().contains("EC")) { containsEc = true; break; } } config.setAddECPointFormatExtension(containsEc); config.setAddEllipticCurveExtension(containsEc); return config; }
/** * * @return */ @Override public Config createConfig() { Config config = super.createConfig(); config.setAddHeartbeatExtension(true); config.setHeartbeatMode(HeartbeatMode.PEER_ALLOWED_TO_SEND); config.setAddRenegotiationInfoExtension(true); config.setAddServerNameIndicationExtension(true); config.setAddSignatureAndHashAlgorithmsExtension(true); config.setQuickReceive(true); config.setStopActionsAfterFatal(true); config.setStopRecievingAfterFatal(true); config.setEarlyStop(true); boolean containsEc = false; for (CipherSuite suite : config.getDefaultClientSupportedCiphersuites()) { KeyExchangeAlgorithm keyExchangeAlgorithm = AlgorithmResolver.getKeyExchangeAlgorithm(suite); if (keyExchangeAlgorithm != null && keyExchangeAlgorithm.name().toUpperCase().contains("EC")) { containsEc = true; break; } } config.setAddECPointFormatExtension(containsEc); config.setAddEllipticCurveExtension(containsEc); return config; } }
tlsConfig.setDefaultClientSupportedCiphersuites(suite); KeyExchangeAlgorithm keyExchangeAlgorithm = AlgorithmResolver.getKeyExchangeAlgorithm(suite); if (keyExchangeAlgorithm != null && keyExchangeAlgorithm.name().toUpperCase().contains("EC")) { tlsConfig.setAddECPointFormatExtension(true); tlsConfig.setAddEllipticCurveExtension(true);
for (CipherSuite suite : config.getDefaultClientSupportedCiphersuites()) { KeyExchangeAlgorithm keyExchangeAlgorithm = AlgorithmResolver.getKeyExchangeAlgorithm(suite); if (keyExchangeAlgorithm != null && keyExchangeAlgorithm.name().toUpperCase().contains("EC")) { containsEc = true; break;