Method: PKCS11::Session#encrypt
- Defined in:
- lib/pkcs11/session.rb
#encrypt(mechanism, key, data = nil) {|PKCS11::Session::Cipher| ... } ⇒ String
Convenience method for the #C_EncryptInit, #C_EncryptUpdate, #C_EncryptFinal call flow.
If no block is given, the single part operation #C_EncryptInit, #C_Encrypt is called. If a block is given, the multi part operation (#C_EncryptInit, #C_EncryptUpdate, #C_EncryptFinal) is used. The given block is called once with a cipher object. There can be any number of PKCS11::Session::Cipher#update calls within the block, each giving the encryption result of this part as String.
317 318 319 320 |
# File 'lib/pkcs11/session.rb', line 317 def encrypt(mechanism, key, data=nil, &block) common_crypt(:C_EncryptInit, :C_EncryptUpdate, :C_EncryptFinal, :C_Encrypt, mechanism, key, data, &block) end |