SMIME Bean
Properties Methods Events Configuration Settings Errors
The SMIME component implements the S/MIME standard for encryption and decryption with public key cryptography and X.509 digital certificates.
Syntax
IPWorksEncrypt.Smime
Remarks
The SMIME bean implements the S/MIME V3 standard for encryption and decryption using Public Key Cryptography Standards (PKCS). In addition the bean can be used to both generate and verify RSA digital signatures. Using this bean for decrypting or signing requires a valid digital certificate with a private key.
To sign the current data included in Message with a certificate, the Certificate property must be set to a valid Certificate object for the signing certificate. The IncludeCertificate and DetachedSignature properties allow you to specify additional details about the signing process. By setting IncludeCertificate to true, digital certificates can be encoded and included in message signature when signing the document. Including a certificate is the preferred method of building signed messages. In addition the SMIME bean can also generate PKCS #7 formatted detached digital signatures and envelopes by specifying DetachedSignature.
To encrypt a message with the bean in a PCKS envelope, you must first specify the Certificate for each recipient in the RecipientCerts collection to encrypt the message with. You can easily add these with the AddRecipientCert method. Once you have done this you can call the Encrypt method to encrypt the message with the recipient certificates.
In addition, the bean allows you to sign and encrypt simultaneously with the SignAndEncrypt method. You must set all of the properties needed for both Sign and Encrypt
The result of the encrypted or signed data will be replaced in the Message property and the MessageHeaders property will be filled with the appropriate mime headers if applicable.
In addition the SMIME bean can be used to verify signatures included in signed messages or documents. The Message property is used to specify the signed message envelope. VerifySignature can then be used to verify the signature. If the message does not have a certificate attached more then likely an exception will be thrown and the bean will not be able to verify the signature. If VerifySignature is successful, the SignerCert and SignerCertChain properties will be filled with the certificate information of the message signer. This information can be used to verify the signing certificates.
Decrypting PKCS envelopes is handled with the Decrypt method. When this method is called, the bean will attempt to find an appropriate certificate in the Certificate property that matches the encrypting certificate. If it cannot find an appropriate certificate an exception will be thrown and the message will not be decrypted.
Similar to SignAndEncrypt, DecryptAndVerifySignature can be used to both decrypt and verify the message in Message.
Property List
The following is the full list of the properties of the bean with short descriptions. Click on the links for further details.
Certificate | The current selected certificate. |
DetachedSignature | Specifies whether to include a detached signature when signing a message. |
EncryptingAlgorithm | Textual description of the encrypting algorithm. |
IncludeCertificate | Specifies whether to include the signer's certificate with the signed message. |
IncludeChain | Specifies whether to include the signer's certificate chain with the signed message. |
InternalHeaders | The headers of the MIME entity inside the encrypted or signed message. |
Message | The fully encoded or decoded S/MIME message. |
MessageEncrypted | Whether or not the current message is encrypted. |
MessageHeaders | Collection of headers from the SMIME message. |
MessageHeadersString | String version of headers from the SMIME message. |
MessageSigned | Whether or not the current message is signed. |
RecipientCerts | The collection of recipient certificates of the message. |
SignerCert | Contains the certificate of the message signer. |
SignerCertChain | The certificate chain of the signing certificate. |
SigningAlgorithm | Textual description of the signature hash algorithm. |
Method List
The following is the full list of the methods of the bean with short descriptions. Click on the links for further details.
addRecipientCert | Used to add recipient certificates used to encrypt messages. |
config | Sets or retrieves a configuration setting . |
decrypt | Decrypts the current Message . |
decryptAndVerifySignature | Decrypts and verifies the signature of the current Message . |
decryptFile | Decrypts the contents of a file. |
encrypt | Encrypts the current Message . |
encryptFile | Encrypts the contents of a file. |
getRecipientInfo | Gets the recipient infos for an encrypted message. |
reset | Resets the component properties. |
setInputStream | Sets the stream from which the component will read data to encode or decode. |
setOutputStream | The stream to which the component will write the fully encoded or decoded S/MIME data. |
sign | Signs the current Message . |
signAndEncrypt | Signs and encrypts the current Message . |
verifySignature | Verifies the signature of the current Message . |
Event List
The following is the full list of the events fired by the bean with short descriptions. Click on the links for further details.
Error | Information about errors during data delivery. |
RecipientInfo | Fired for each recipient certificate of the encrypted message. |
SignerCertInfo | Fired during verification of the signed message. |
Configuration Settings
The following is a list of configuration settings for the bean with short descriptions. Click on the links for further details.
ApplyB64Encoding | Instructs the component to base64 encode the message when signing or encrypting. |
CSP | The Cryptographic Service Provider. |
GenerateSignatureTimestamp | Whether to generate timestamps in signatures. |
IncludeHeaders | Tells the component whether to include the headers when encoding the message. |
IncludeInternalHeaders | Tells the component whether or not to include the internal headers when encoding the message. |
ParseInternalHeaders | Tells the component whether or not to parse the message part headers when decrypting a message. |
RecipientCert | Used to specify the public certificate when using a PEM key to decrypt. |
RecipientCertFile | Used to specify the public certificate file when using a PEM key to decrypt. |
UseCryptoAPI | Whether to use the Microsoft Crypto API for cryptographic message generation. |
CodePage | The system code page used for Unicode to Multibyte translations. |