EncodeUint8ArrayWithUint8Length() public static method

public static EncodeUint8ArrayWithUint8Length ( byte uints ) : byte[]
uints byte
return byte[]
Exemplo n.º 1
0
 public static byte[] CreateNegotiatedDheGroupsClientExtension(byte[] dheGroups)
 {
     if (((dheGroups == null) || (dheGroups.Length < 1)) || (dheGroups.Length > 0xff))
     {
         throw new TlsFatalAlert(80);
     }
     return(TlsUtilities.EncodeUint8ArrayWithUint8Length(dheGroups));
 }
Exemplo n.º 2
0
 public static byte[] CreateSupportedPointFormatsExtension(byte[] ecPointFormats)
 {
     if (ecPointFormats == null || !Arrays.Contains(ecPointFormats, 0))
     {
         ecPointFormats = Arrays.Append(ecPointFormats, 0);
     }
     return(TlsUtilities.EncodeUint8ArrayWithUint8Length(ecPointFormats));
 }
Exemplo n.º 3
0
        public static byte[] CreateNegotiatedDheGroupsClientExtension(byte[] dheGroups)
        {
            if (dheGroups == null || dheGroups.Length < 1 || dheGroups.Length > 255)
            {
                throw new TlsFatalAlert(AlertDescription.internal_error);
            }

            return(TlsUtilities.EncodeUint8ArrayWithUint8Length(dheGroups));
        }
Exemplo n.º 4
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));
        }
Exemplo n.º 5
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));
        }