You can obtain an instance of the implementation of this interface as follows:
SecurityServiceInterface securityService = com.ibm.bcg.bcgdk.workflow.BusinessProcessUtil.getSecurityService();
encryptBytes
This method encrypts the given data by using the given algorithm that uses the currently valid certificate of the to-partner specified in the business document. Encryption is done in accordance with the PKCS #7 standard described in PKCS #7: Cryptographic Message Syntax, section 10.
The method has two forms. One takes input as a byte array. The other takes input as an InputStream object.
Byte array input
public byte[] encryptBytes(BusinessDocumentInterface businessDocument, byte[] inBuf, String encryptionAlg) throws BCGSecurityException
InputStream input
public InputStream encryptBytes(BusinessDocumentInterface businessDocument, InputStream inStream, String encryptionAlg) throws BCGSecurityException
Byte array input
InputStream input
Byte array input
Encrypted data that is PKCS7 EnvelopedData in encoded form.
InputStream input
InputStream for the encrypted data. The encrypted data is PKCS7 EnvelopedData in encoded form.
com.ibm.bcg.bcgdk.services.BCGSecurityException - if any exception occurs.
decryptBytes
This method decrypts the given encrypted data. It expects the encrypted data to be in an encoded form of PKCS #7 EnvelopedData. So encryption must be done in accordance with the PKCS #7 standard described in PKCS #7: Cryptographic Message Syntax, section 10.
The method has two forms. One takes input as a byte array. The other takes input as an InputStream object.
Byte array input
public byte[] decryptBytes(BusinessDocumentInterface businessDocument, byte[] inBuf, String algName) throws BCGSecurityException
InputStream input
public InputStream decryptBytes(BusinessDocumentInterface businessDocument, InputStream inStream, String algName) throws BCGSecurityException
Byte array input
InputStream input
Decrypted data.
com.ibm.bcg.bcgdk.services.BCGSecurityException - if any exception occurs.
signMessage
This method generates a signature for the given data. The signature is in the form of an encoded PKCS #7 ContentInfo object that contains a PKCS #7 SignedData object.
The method has two forms. One takes input as a byte array. The other takes input as an InputStream object.
Byte array input
public SignInfo signMessage(BusinessDocumentInterface businessDocument, byte[] data, String micAlg) throws BCGSecurityException
InputStream input
public SignInfo signMessage(BusinessDocumentInterface businessDocument, InputStream inStream, String micAlg) throws BCGSecurityException
Byte array input
InputStream input
SignInfo or null if an error occurs. Signature is in the form of encoded PKCS #7 ContentInfo object that contains a PKCS #7 SignedData object.
com.ibm.bcg.bcgdk.services.BCGSecurityException - if any exception occurs.
verifySignature
This method verifies the signature for the given message. The signature is verified by using the signature verification certificate of the sender participant.
The method has two forms. One takes input as a byte array. The other takes input as an InputStream object.
Byte array input
public SignInfo verifySignature(BusinessDocumentInterface businessDocument, byte[] signature, byte[] messageContent, String senderId, String signatureAlgo) throws BCGSecurityException
InputStream input
public SignInfo verifySignature(BusinessDocumentInterface businessDocument, byte[] signature, InputStream messageStream, String senderId, String signatureAlgo) throws BCGSecurityException
Byte array input
InputStream input
SignInfo or null if an error occurs. Signature is in the form of encoded PKCS #7 ContentInfo object that contains a PKCS #7 SignedData object.
com.ibm.bcg.bcgdk.services.BCGSecurityException - if any exception occurs.
generateDigest
This method calculates a digest of a specified message by using a specified algorithm.
The method has two forms. One takes input as a byte array. The other takes input as an InputStream object.
Byte array input
public byte[] generateDigest(byte[] data, String alg) throws BCGSecurityException
InputStream input
public byte[] generateDigest(java.io.InputStream inStream, String alg) throws BCGSecurityException
Byte array input
InputStream input
Digest as a byte array.
com.ibm.bcg.bcgdk.services.BCGSecurityException - if any exception occurs.
These constants define encryption and signature types:
public final String BCG_ENC_ALG_DES="3des" public final String BCG_ENC_ALG_RC2 = "RC2" public final String BCG_ENCRYPT_ALG_DESEDE = "DESede" public final String BCG_SIGN_ALG_SHA1 = "sha1" public final String BCG_SIGN_ALG_MD5 = "md5"
The following fields are used by SecurityServiceInterface methods: