# How to create PSK key? [closed]

I'd like to create a PSK key to use with TLS-RSA-PSK-WITH-AES-256-CBC-SHA - what is the format of this key?

-

## closed as off-topic by e-sushi♦, figlesquidge, Gilles, AFS, DrLecterMar 19 '14 at 21:15

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

This question does not appear to be about cryptography within the scope defined in the help center… it is software recommendation request. – e-sushi Mar 19 '14 at 20:38
This question appears to be off-topic because it is about the programming aspects of using a cryptographic library, and best answered by reading the documentation anyway. – Gilles Mar 19 '14 at 20:56

I would use the Interactive Ruby (irb) command.

  bash> irb
irb> require 'securerandom'
=> true
irb> SecureRandom.base64(256/8)
=> "qOo64focYhXyCPH3z5zpKyhNqQmTgtAVIP4mgJFnjrM="


This will produce a cryptographically secure random bit sequence, encoded in base64. This one is 32 bytes or 256 bits long. If you prefer hex format, try this:

  irb> SecureRandom.hex(256/8)
=> "a66d258de75987d31a4537ecd1ff7a34517bf92f2c07abb20fa0fb517f2491f1"

-