I am little confused with your question because file extension .p7b is usually used for PKCS#7 structure that includes only certificates (not signature) and it is more common to use .p7s extension for PKCS#7 structure that includes signature. But never mind it is the file content that matters not the file extension.
You did not specify where are your signing certificate and private key stored so let's just assume that you have your PEM encoded X.509 signing certificate stored in file "signer.cer" and your PEM encoded PKCS#1 private key stored in file "signer.key".
You can use OpenSSL.exe command line utility to sign the file "file.bin" and output the signature stored in DER encoded PKCS#7 structure into the file "file.p7b":
openssl.exe smime -sign -binary -in file.bin -signer signer.cer -inkey signer.key -outform DER -out file.p7b
You can use following command to verify the signature:
openssl.exe smime -verify -binary -inform DER -in file.p7b -content file.bin -noverify > nul
See OpenSSL SMIME module manual for more details about individual options.