1
$\begingroup$

Is there any reasonable ASN.1 standard to encode symmetric keys?

I found PSKC, but it seems extremely heavy, and I can't quite find any library (e.g. bouncycastle) that would simplify using it.

If all I need is to encode a symmetric key, would it be sufficient to just include:

  • algorithm ID
  • block size
  • key size
  • key bits
$\endgroup$
1
  • 1
    $\begingroup$ Depends on what you do with it really. A lot of times it is only required to encode the bytes if e.g. the algorithm is static, there is only one block size, and the encoding is such that it can be distinguished from other bytes in the data structure. $\endgroup$ – Maarten Bodewes Sep 24 '15 at 20:31
1
$\begingroup$

For the algorithm you should use the AlgorithmIdentifier type of RFC5280. Block size and key size can be derived from the algorithm id and the key itself, so there is no need to store them.

So, if you want something really lightweight, just store that into a sequence:

SymmetricKey ::= SEQUENCE {
  algorithm AlgorithIdentifier,
  key       BIT STRING
}
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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