org.spongycastle.util.Arrays.contains()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(111)

本文整理了Java中org.spongycastle.util.Arrays.contains()方法的一些代码示例,展示了Arrays.contains()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Arrays.contains()方法的具体详情如下:
包路径:org.spongycastle.util.Arrays
类名称:Arrays
方法名:contains

Arrays.contains介绍

暂无

代码示例

代码示例来源:origin: matsjj/thundernetwork

public void measure (String event) {
  time2 = System.currentTimeMillis();
  if (Arrays.contains(Constants.LOG_LEVELS, 1)) {
    System.out.println((time2 - time1) + "		" + event);
  }
  time1 = System.currentTimeMillis();
}

代码示例来源:origin: com.madgag.spongycastle/core

private static void checkNamedCurve(int[] namedCurves, int namedCurve) throws IOException
{
  if (namedCurves != null && !Arrays.contains(namedCurves, namedCurve))
  {
    /*
     * RFC 4492 4. [...] servers MUST NOT negotiate the use of an ECC cipher suite
     * unless they can complete the handshake while respecting the choice of curves
     * and compression techniques specified by the client.
     */
    throw new TlsFatalAlert(AlertDescription.illegal_parameter);
  }
}

代码示例来源:origin: com.madgag.spongycastle/bctls-jdk15on

public static void checkActualFormat(short[] localECPointFormats, short actualFormat) throws IOException
{
  if (actualFormat != ECPointFormat.uncompressed
    && (localECPointFormats == null || !Arrays.contains(localECPointFormats, actualFormat)))
  {
    throw new TlsFatalAlert(AlertDescription.illegal_parameter);
  }
}

代码示例来源:origin: com.madgag.spongycastle/bctls-jdk15on

private static short[] checkNameType(short[] nameTypesSeen, short nameType)
  {
    /*
     * RFC 6066 3. The ServerNameList MUST NOT contain more than one name of the same
     * name_type.
     */
    if (!NameType.isValid(nameType) || Arrays.contains(nameTypesSeen, nameType))
    {
      return null;
    }
    return Arrays.append(nameTypesSeen, nameType);
  }
}

代码示例来源:origin: com.madgag.spongycastle/bctls-jdk15on

public short getSelectedCompressionMethod()
  throws IOException
{
  short[] compressionMethods = getCompressionMethods();
  for (int i = 0; i < compressionMethods.length; ++i)
  {
    if (Arrays.contains(offeredCompressionMethods, compressionMethods[i]))
    {
      return this.selectedCompressionMethod = compressionMethods[i];
    }
  }
  throw new TlsFatalAlert(AlertDescription.handshake_failure);
}

代码示例来源:origin: com.madgag.spongycastle/bctls-jdk15on

public static short[] readSupportedPointFormatsExtension(byte[] extensionData) throws IOException
{
  short[] ecPointFormats = TlsUtils.decodeUint8ArrayWithUint8Length(extensionData);
  if (!Arrays.contains(ecPointFormats, ECPointFormat.uncompressed))
  {
    /*
     * RFC 4492 5.1. If the Supported Point Formats Extension is indeed sent, it MUST
     * contain the value 0 (uncompressed) as one of the items in the list of point formats.
     */
    throw new TlsFatalAlert(AlertDescription.illegal_parameter);
  }
  return ecPointFormats;
}

代码示例来源:origin: com.madgag.spongycastle/core

public static byte[] createSupportedPointFormatsExtension(short[] ecPointFormats) throws IOException
{
  if (ecPointFormats == null || !Arrays.contains(ecPointFormats, ECPointFormat.uncompressed))
  {
    /*
     * RFC 4492 5.1. If the Supported Point Formats Extension is indeed sent, it MUST
     * contain the value 0 (uncompressed) as one of the items in the list of point formats.
     */
    // NOTE: We add it at the end (lowest preference)
    ecPointFormats = Arrays.append(ecPointFormats, ECPointFormat.uncompressed);
  }
  return TlsUtils.encodeUint8ArrayWithUint8Length(ecPointFormats);
}

代码示例来源:origin: com.madgag.spongycastle/core

public short getSelectedCompressionMethod()
  throws IOException
{
  short[] compressionMethods = getCompressionMethods();
  for (int i = 0; i < compressionMethods.length; ++i)
  {
    if (Arrays.contains(offeredCompressionMethods, compressionMethods[i]))
    {
      return this.selectedCompressionMethod = compressionMethods[i];
    }
  }
  throw new TlsFatalAlert(AlertDescription.handshake_failure);
}

代码示例来源:origin: com.madgag.spongycastle/bctls-jdk15on

public static byte[] createSupportedPointFormatsExtension(short[] ecPointFormats) throws IOException
{
  if (ecPointFormats == null || !Arrays.contains(ecPointFormats, ECPointFormat.uncompressed))
  {
    /*
     * RFC 4492 5.1. If the Supported Point Formats Extension is indeed sent, it MUST
     * contain the value 0 (uncompressed) as one of the items in the list of point formats.
     */
    // NOTE: We add it at the end (lowest preference)
    ecPointFormats = Arrays.append(ecPointFormats, ECPointFormat.uncompressed);
  }
  return TlsUtils.encodeUint8ArrayWithUint8Length(ecPointFormats);
}

代码示例来源:origin: com.madgag.spongycastle/core

private static short[] checkNameType(short[] nameTypesSeen, short nameType)
  {
    /*
     * RFC 6066 3. The ServerNameList MUST NOT contain more than one name of the same
     * name_type.
     */
    if (!NameType.isValid(nameType) || Arrays.contains(nameTypesSeen, nameType))
    {
      return null;
    }
    return Arrays.append(nameTypesSeen, nameType);
  }
}

代码示例来源:origin: com.madgag.spongycastle/bctls-jdk15on

protected boolean isSelectableCipherSuite(int cipherSuite, int availCurveBits, Vector sigAlgs)
{
  return Arrays.contains(this.offeredCipherSuites, cipherSuite)
    && TlsUtils.isValidCipherSuiteForVersion(cipherSuite, serverVersion)
    && availCurveBits >= TlsECCUtils.getMinimumCurveBits(cipherSuite)
    && TlsUtils.isValidCipherSuiteForSignatureAlgorithms(cipherSuite, sigAlgs);
}

代码示例来源:origin: com.madgag.spongycastle/core

public static short[] readSupportedPointFormatsExtension(byte[] extensionData) throws IOException
{
  if (extensionData == null)
  {
    throw new IllegalArgumentException("'extensionData' cannot be null");
  }
  ByteArrayInputStream buf = new ByteArrayInputStream(extensionData);
  short length = TlsUtils.readUint8(buf);
  if (length < 1)
  {
    throw new TlsFatalAlert(AlertDescription.decode_error);
  }
  short[] ecPointFormats = TlsUtils.readUint8Array(length, buf);
  TlsProtocol.assertEmpty(buf);
  if (!Arrays.contains(ecPointFormats, ECPointFormat.uncompressed))
  {
    /*
     * RFC 4492 5.1. If the Supported Point Formats Extension is indeed sent, it MUST
     * contain the value 0 (uncompressed) as one of the items in the list of point formats.
     */
    throw new TlsFatalAlert(AlertDescription.illegal_parameter);
  }
  return ecPointFormats;
}

代码示例来源:origin: com.madgag.spongycastle/core

if (Arrays.contains(namedCurves, NamedCurve.arbitrary_explicit_prime_curves))
else if (Arrays.contains(namedCurves, NamedCurve.arbitrary_explicit_char2_curves))

代码示例来源:origin: com.madgag.spongycastle/core

if (Arrays.contains(this.offeredCipherSuites, cipherSuite)
  && (eccCipherSuitesEnabled || !TlsECCUtils.isECCCipherSuite(cipherSuite))
  && TlsUtils.isValidCipherSuiteForVersion(cipherSuite, serverVersion)

代码示例来源:origin: com.madgag.spongycastle/core

boolean noRenegExt = (null == renegExtData);
boolean noRenegSCSV = !Arrays.contains(state.offeredCipherSuites, CipherSuite.TLS_EMPTY_RENEGOTIATION_INFO_SCSV);
if (fallback && !Arrays.contains(state.offeredCipherSuites, CipherSuite.TLS_FALLBACK_SCSV))

代码示例来源:origin: com.madgag.spongycastle/core

&& (ecPointFormats == null || !Arrays.contains(ecPointFormats, actualFormat)))

代码示例来源:origin: com.madgag.spongycastle/bctls-jdk15on

boolean noRenegExt = (null == renegExtData);
boolean noRenegSCSV = !Arrays.contains(state.offeredCipherSuites, CipherSuite.TLS_EMPTY_RENEGOTIATION_INFO_SCSV);
if (fallback && !Arrays.contains(state.offeredCipherSuites, CipherSuite.TLS_FALLBACK_SCSV))

代码示例来源:origin: com.madgag.spongycastle/core

if (!Arrays.contains(this.offeredCipherSuites, sessionParameters.getCipherSuite())
  || !Arrays.contains(this.offeredCompressionMethods, sessionParameters.getCompressionAlgorithm()))
boolean noRenegExt = (null == renegExtData);
boolean noRenegSCSV = !Arrays.contains(offeredCipherSuites, CipherSuite.TLS_EMPTY_RENEGOTIATION_INFO_SCSV);
if (fallback && !Arrays.contains(offeredCipherSuites, CipherSuite.TLS_FALLBACK_SCSV))

代码示例来源:origin: com.madgag.spongycastle/bctls-jdk15on

if (!Arrays.contains(this.offeredCipherSuites, sessionParameters.getCipherSuite())
  || !Arrays.contains(this.offeredCompressionMethods, sessionParameters.getCompressionAlgorithm()))
boolean noRenegExt = (null == renegExtData);
boolean noRenegSCSV = !Arrays.contains(offeredCipherSuites, CipherSuite.TLS_EMPTY_RENEGOTIATION_INFO_SCSV);
if (fallback && !Arrays.contains(offeredCipherSuites, CipherSuite.TLS_FALLBACK_SCSV))

代码示例来源:origin: com.madgag.spongycastle/core

tlsServer.notifyFallback(Arrays.contains(offeredCipherSuites, CipherSuite.TLS_FALLBACK_SCSV));
  if (Arrays.contains(offeredCipherSuites, CipherSuite.TLS_EMPTY_RENEGOTIATION_INFO_SCSV))

相关文章