TLS/PSK key length - ssl

Is there a maximum length for the length of the key. I am using gnutls's psktool to create keys and I need to create key of the size of 128 bits. but the maximum value it lets me to use as key length is 64 Is this impossible.

Gnutls's psktool takes the key size in bytes, not in bits. So the maximum length is 64 bytes = 512 bits.

Related

How do I output the Int size in bits, min, and max in Kotlin?

I already have an example with Byte, here it is:
8
-128
127
I need to do the same with type Integer.
Adding onto the above value you can also print the file size of an Int in Bits by doing..
println(Int.SIZE_BITS)
Full answer:
println(Int.SIZE_BITS)
println(Int.MIN_VALUE)
println(Int.MAX_VALUE)

why in bip32 entropy's max size is 512 bit , but bip39 is 256 bit?

from bip 32 https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
Generate a seed byte sequence S of a chosen length (between 128 and 512 bits; 256 bits is advised) from a (P)RNG.
max entropy can be 512bit
from bip 39 https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki
The allowed size of ENT is 128-256 bits.
max entropy can only be 256bit(use 24 words).
so why we cant use 48 word create a 512bit entropy under bip39?

Getting TPM's public EK: meaning of leading/trailing bits

I have been trying to get a TPM's EK's public key using two methods:
using Hyper-V's Get-PlatformIdentifier I get the following result:
3082010a0282010100<EKPUBLICKEY>0203010001
Using Urchin's C Library:
<EKPUBLICKEY>
Can anyone explain what do 3082010a0282010100 and 0203010001 mean/encode?
It is DER Encoding of format for ASN.1 Types.
For example, 3082010A0282010100<KEY>0203010001
30: said SEQUENCE type
82010A: Said SEQUENCE of length 010A (82 of which more than 80, indicates the length information of 2 bytes.)
02: Integer type
820101: An integer representing the length of 0101 (decimal 257)
00<KEY>: The integer is modulus, 00 used to denote a positive integer, deduct 00 and 256 bytes, so the modulus is 256 bytes
Finally Exponent
0203010001: 02 integer representing the length of 3010001 Exponent, 03

What is the minimum size of an address register for a computer with 5TB of memory?

There is this question that I'm having a bit a difficulty to answer
Here it is:
An n-bit register can hold 2^n distinct bit patterns. As such,
it can only be used to address a memory whose number of addressable units
(typically, bytes) is less than or equal to 2^n. In this question, register
sizes need not be a power of two. K = 2^10
a) What is the minimum size of an address register for a computer
with 5 TB of memory?
b) What is the minimum size of an address register for a computer
with 7 TBs of memory?
c) What is the minimum size of an address register for a computer
with 2.5 PBs of memory?
From the conversion, I know that:
1KB = $2^{10}$ bytes
1MB = $2^{20}$ bytes
1GB = $2^{30}$ bytes
1TB = $2^{40}$ bytes
If I convert 5TB into bytes we get 5,497,558,138,880 bytes
What would be the next step though? I know that 1 byte = 8 bits
This is how I would proceed:
1 TB = 2^40 bytes
Calculate the number of bytes in 5 TB = 5,497,558,138,880 bytes (assume this number is n);
The logarithmic function log(Base2)(n) = the minimum size of an address register and in this case it would be 42.321928095 bits which I would round up to 43 bits.
Same logic for the other questions.
I suggest you divide by 8.
5,497,558,138,880/8 = 687194767360
Using logarithms, 2^n = 687194767360 therefore log2(687194767360) = n
Therefore n = 39.321928095
The same steps can be used to achieve part b and c

What is the max possible size of an 32x32px .ico file?

I'm making a favicon.ico script, and I need to know the max amount of bits possible.
It depends on the number of colours you are using.
For 8bit (256 colours):
32 * 32 * 8 = 8192 bits
8192 / 8 = 1024 bytes
1024 bytes = 1Kb
For 32bit (16.7 million colours):
32 * 32 * 32 = 32768 bits
32768 / 8 = 4096 bytes
4096 bytes = 4Kb
See wikipedia.
It maxes out at 32 bits per pixel, 24 RGB plus alpha transparency, so that would be 32 x 32 x 32, or 32768 bits.
So 4096 bytes (4K).
In theory, a single ico file can contain up to 65,535 images (see header description). That would mean that the maximum number of pixels could be as large as 65535*32*32, which at 4 bytes per pixel comes to 268,435,456 bytes.