Incerteza
Incerteza

Reputation: 34934

HMAC, RS and Base64 in Rust

I have a project in which RS and HMAC 256...512 are involved and base64. Is there any way to do encoding and decoding in such the algorithms in Rust already? If so, is it safe to them now, at this point of Rust development stage?

Upvotes: 4

Views: 2211

Answers (1)

Félix Saparelli
Félix Saparelli

Reputation: 8749

(By 'RS' I'm assuming you're speaking of RS256 and siblings, which are identifiers defined in RFC7518 for specific suites of asymmetric cryptography using RSA and SHA2 functions.)

These three algorithms are vastly different:

  • HMAC is an authentication algorithm often used alongside symmetric crypto, and it is digest agnostic; so you also need a library of digest / hash functions. ring is a pure-Rust high-quality implementation of various mainstream cryptographic algorithms, such as AES, HMAC, SHA1/2/3, AEAD, etc.

  • RSA is a cryptosystem for public key cryptography. Ring, mentioned above, supports modern configurations of the system. For other/older configurations, you may use the rust-openssl bindings, or native-tls.

  • Base64 is a binary-to-text encoding (not encryption). The base64 crate is the recommended way to handle it.

The question of how safe these are to use is highly subjective and depends on your use-case, and as such StackOverflow is not a good venue for that discussion.

Upvotes: 6

Related Questions