@@ -851,22 +851,6 @@ Init_ossl_cipher(void)
851
851
*
852
852
* cipher = OpenSSL::Cipher.new('AES-128-CBC')
853
853
*
854
- * For each algorithm supported, there is a class defined under the
855
- * Cipher class that goes by the name of the cipher, e.g. to obtain an
856
- * instance of AES, you could also use
857
- *
858
- * # these are equivalent
859
- * cipher = OpenSSL::Cipher::AES.new(128, :CBC)
860
- * cipher = OpenSSL::Cipher::AES.new(128, 'CBC')
861
- * cipher = OpenSSL::Cipher::AES.new('128-CBC')
862
- *
863
- * Finally, due to its wide-spread use, there are also extra classes
864
- * defined for the different key sizes of AES
865
- *
866
- * cipher = OpenSSL::Cipher::AES128.new(:CBC)
867
- * cipher = OpenSSL::Cipher::AES192.new(:CBC)
868
- * cipher = OpenSSL::Cipher::AES256.new(:CBC)
869
- *
870
854
* === Choosing either encryption or decryption mode
871
855
*
872
856
* Encryption and decryption are often very similar operations for
@@ -895,7 +879,7 @@ Init_ossl_cipher(void)
895
879
* without processing the password further. A simple and secure way to
896
880
* create a key for a particular Cipher is
897
881
*
898
- * cipher = OpenSSL::Cipher::AES256 .new(: CFB)
882
+ * cipher = OpenSSL::Cipher.new('AES-256- CFB' )
899
883
* cipher.encrypt
900
884
* key = cipher.random_key # also sets the generated key on the Cipher
901
885
*
@@ -963,14 +947,14 @@ Init_ossl_cipher(void)
963
947
*
964
948
* data = "Very, very confidential data"
965
949
*
966
- * cipher = OpenSSL::Cipher::AES .new(128, : CBC)
950
+ * cipher = OpenSSL::Cipher.new('AES- 128- CBC' )
967
951
* cipher.encrypt
968
952
* key = cipher.random_key
969
953
* iv = cipher.random_iv
970
954
*
971
955
* encrypted = cipher.update(data) + cipher.final
972
956
* ...
973
- * decipher = OpenSSL::Cipher::AES .new(128, : CBC)
957
+ * decipher = OpenSSL::Cipher.new('AES- 128- CBC' )
974
958
* decipher.decrypt
975
959
* decipher.key = key
976
960
* decipher.iv = iv
@@ -1006,7 +990,7 @@ Init_ossl_cipher(void)
1006
990
* not to reuse the _key_ and _nonce_ pair. Reusing an nonce ruins the
1007
991
* security guarantees of GCM mode.
1008
992
*
1009
- * cipher = OpenSSL::Cipher::AES .new(128, : GCM).encrypt
993
+ * cipher = OpenSSL::Cipher.new('AES- 128- GCM' ).encrypt
1010
994
* cipher.key = key
1011
995
* cipher.iv = nonce
1012
996
* cipher.auth_data = auth_data
@@ -1022,7 +1006,7 @@ Init_ossl_cipher(void)
1022
1006
* ciphertext with a probability of 1/256.
1023
1007
*
1024
1008
* raise "tag is truncated!" unless tag.bytesize == 16
1025
- * decipher = OpenSSL::Cipher::AES .new(128, : GCM).decrypt
1009
+ * decipher = OpenSSL::Cipher.new('AES- 128- GCM' ).decrypt
1026
1010
* decipher.key = key
1027
1011
* decipher.iv = nonce
1028
1012
* decipher.auth_tag = tag
0 commit comments