Method: PKCS11::Session#C_EncryptInit

Defined in:
lib/pkcs11/session.rb

#C_EncryptInit(mechanism, key) ⇒ PKCS11::Session

Initializes an encryption operation.

See #encrypt for convenience

The CKA_ENCRYPT attribute of the encryption key, which indicates whether the key supports encryption, must be true.

After calling #C_EncryptInit, the application can either call #C_Encrypt to encrypt data in a single part; or call #C_EncryptUpdate zero or more times, followed by #C_EncryptFinal, to encrypt data in multiple parts. The encryption operation is active until the application uses a call to #C_Encrypt or #C_EncryptFinal to actually obtain the final piece of ciphertext. To process additional data (in single or multiple parts), the application must call #C_EncryptInit again.

Parameters:

Returns:



257
258
259
260
# File 'lib/pkcs11/session.rb', line 257

def C_EncryptInit(mechanism, key)
  @pk.C_EncryptInit(@sess, to_mechanism(mechanism), key)
  self
end