public static byte[] CreateSupportedPointFormatsExtension(byte[] ecPointFormats)
 {
     if (ecPointFormats == null || !Arrays.Contains(ecPointFormats, 0))
     {
         ecPointFormats = Arrays.Append(ecPointFormats, 0);
     }
     return(TlsUtilities.EncodeUint8ArrayWithUint8Length(ecPointFormats));
 }
 public static byte[] CreateNegotiatedDheGroupsClientExtension(byte[] dheGroups)
 {
     if (dheGroups == null || dheGroups.Length < 1 || dheGroups.Length > 255)
     {
         throw new TlsFatalAlert(80);
     }
     return(TlsUtilities.EncodeUint8ArrayWithUint8Length(dheGroups));
 }
Пример #3
0
        /// <exception cref="IOException"></exception>
        public static byte[] CreateCertificateTypeExtensionClient(byte[] certificateTypes)
        {
            if (certificateTypes == null || certificateTypes.Length < 1 || certificateTypes.Length > 255)
            {
                throw new TlsFatalAlert(AlertDescription.internal_error);
            }

            return(TlsUtilities.EncodeUint8ArrayWithUint8Length(certificateTypes));
        }
Пример #4
0
        public static byte[] CreateSupportedPointFormatsExtension(byte[] ecPointFormats)
        {
            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(TlsUtilities.EncodeUint8ArrayWithUint8Length(ecPointFormats));
        }