Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

closed as off-topic by e-sushi, figlesquidge, Gilles, AFS, DrLecter Mar 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
up vote 1 down vote accepted

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"
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.