1
$\begingroup$

is it a good idea to use global values as nonce / additional data? What problems can occur? What should be take in account when we deal with such parameters for encryption.

Thanks

$\endgroup$
  • 1
    $\begingroup$ Is this question about cryptography, or is it about the design of an API to a function (which happens to perform a cryptographical task)? $\endgroup$ – poncho Jan 23 '15 at 2:36
1
$\begingroup$

It is not clear what you are attempting to do. AES in itself does not need a nonce, it only needs a key. If you are using an algorithm which uses AES, such as AES-GCM then the nonce must never be reused (In general when using cryptographic protocols, never reuse a nonce!).

If by global value, you mean one which is constant, this ruins the security of any nonce using protocol. If you simply mean using a global variable as an engineering question, this is usually not advisable, as you are not encapsulating the nonce, but should not ruin the cryptographic security of any algorithm, provided the nonce is used only once.

$\endgroup$
  • 1
    $\begingroup$ Strictly speaking, you must never reuse a (key, nonce) pair. $\endgroup$ – CodesInChaos Apr 23 '15 at 17:55

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