Is there any way to change token label using C_SetAttributeValue? what template is being used to change token name as I tried with below function got error iaik.pkcs.pkcs11.wrapper.PKCS11Exception: CKR_TEMPLATE_INCOMPLETE
token = getToken();
CK_ATTRIBUTE[] attrs = new CK_ATTRIBUTE[2];
attrs[0] = new CK_ATTRIBUTE();
attrs[0].type = PKCS11Constants.CKA_LABEL;
attrs[0].pValue = label.toCharArray();
attrs[1] = new CK_ATTRIBUTE();
attrs[1].type = PKCS11Constants.CKA_ID;
attrs[1].pValue = label.toCharArray();
token.getSlot().getModule().getPKCS11Module().C_SetAttributeValue(
session.getSessionHandle(), token.getSlot().getSlotID(), attrs, true);
Hello on StackOverflow!
Have a look at C_SetAttributeValue definition:
CK_DEFINE_FUNCTION(CK_RV, C_SetAttributeValue)(
CK_SESSION_HANDLE hSession,
CK_OBJECT_HANDLE hObject,
CK_ATTRIBUTE_PTR pTemplate,
CK_ULONG ulCount
);
The second parameter is the Object ID, not the slot ID.
Please refer to your library's manufacturer documentation for extensions to PKCS#11 that allow to set token label.
C_SetAttributeValue is categorized as an object-management function. More precisely, the cryptoki function C_SetAttributeValue is used to modify or set an attribute value of an object (not token). If you use a standard PKCS#11 library, you should use C_initToken to change or set the token label.
Please note that a company may provide some non-standard functions for its own products. Thus, it might be also a non-standard function or extension in a specific product that helps you to change the token label.
Related
I'm trying to create a campaign that must target mobile devices only, using the google ads API client library in python. The documentation says that I have to modify the DeviceInfo criteria, but that attribute is immutable.
This is my code rn:
campaign_service = client.get_service("CampaignService")
campaign_criterion_service = client.get_service("CampaignCriterionService")
# Create the campaign criterion.
campaign_criterion_operation = client.get_type("CampaignCriterionOperation")
campaign_criterion = campaign_criterion_operation.create
campaign_criterion.campaign = campaign_service.campaign_path(
customer_id, campaign_id
)
campaign_criterion.device = client.enums.DeviceEnum.MOBILE
What am I missing?
For most of Enums you have to use the .type_ after the value you wanna set.
So you should use:
campaign_criterion.device.type_ = client.enums.DeviceEnum.MOBILE
A nice advice is to download library code and goes into reading that.
I know its possible to read a parameter externally from the iFrame of the configurator
const frameColour = params.find(({ key }) => key === "frameColour");
but is it possible to on the ADD TO CART action to read the value of a Parameter Key (frameColour) and display it in an HTML DIV / Input? The reason for this is I have the parameter key that is the colour of the Shelf Frame I'm building, I want to be able to read the colour and display it to the Screen, then I can store that colour in my external database
After you've created a new configurator using the embedding API you can use this to get notified about parameter updates:
configurator.extended.callbacks.onUpdateParameters = (parameters) => {
// add your logic here
};
configurator.extended will give you access to the RoomleConfigurator instance (https://docs.roomle.com/web/api/classes/roomleconfigurator.html)
I want to restrict the account lookup (domain) based on the value entered in GL Prefix (I'll actually use some wildcards and some other logic which I'm comfortable adding later), the problem is that I'm getting a logical True or False value returned by self.x_poLineGLprefix rather than the value in the field. How do I get the actual data value of x_poLineGLprefix?
class QuickPOLine(models.Model):
_name = 'purchase.order.line'
_inherit = 'purchase.order.line'
x_poLineGLprefix = fields.Char(string='GL Prefix')
x_poLineGLaccount = fields.Many2one(
'account.account', string="Line Item Expense Account",
domain=lambda self: [('code', '=', self.x_poLineGLprefix)])
Try this
#api.onchange('x_poLineGLprefix')
def onchange_x_poLineGLprefix(self):
if self.x_poLineGLprefix:
return {'domain': {
'x_poLineGLaccount': [('code', '=', self.x_poLineGLprefix)]
}}
You can add dynamic domain to achieve this based on any field. In #api.onchange() function you can return domain for many2one. To add dynamic domain you can refer this link. If you are using both many2one fields refer this link.
I want my SAPUI5 ODataModel to send OData requests of the form
https://<my-server>/<my-service>/<my-resource>?search='lalaland'
There are tons of examples how to add a filter with model.filter(new Filter(...)); but this is not what I want. Filtering means I directly address a certain property with a certain comparator. Searching means I address the resource in general and let the OData service decide which properties to search, and how.
The one thing that seems to be possible is:
model.bindRows(..., { "customData": {"search": "lalaland"}});
But this is also not what I want because that sets the search term once when the model is created, but cannot update it later on when the user enters.
Funnily, SAPUI5's own implementation of the SmartTable performs exactly the kind of query I want - but doesn't reveal a possibility how I could do that without a SmartTable.
Found one solution:
oList = this.byId("list"); // or oTable
oBindingInfo = oList.getBindingInfo("items"); // or "rows"
if (!oBindingInfo.parameters) {
oBindingInfo.parameters = {};
}
if (!oBindingInfo.parameters.custom) {
oBindingInfo.parameters.custom = {};
}
oBindingInfo.parameters.custom.search = sValue;
oList.bindItems(oBindingInfo);
However, I don't specifically like the bindItems part. Looks a bit over-the-top to require this to re-bind the whole entity set again and again. So leaving this question open in case somebody has a better idea.
You can use on bindItems or bindRows depending what control is, something like this:
oList = this.byId("list");
oList.bindItems({path: '/XXXX', parameters : {custom: {'search':'searchstring'}}})
Why does it has to be $search and not $filter?
The OData V4 Tutorial in SAPUI5's Demo Kit uses
onSearch : function () {
var oView = this.getView(),
sValue = oView.byId("searchField").getValue(),
oFilter = new Filter("LastName", FilterOperator.Contains, sValue);
oView.byId("peopleList").getBinding("items").filter(oFilter, FilterType.Application);
},
I have written an Outlook plugin that basically allows emails being received through Outlook to be linked with a website so that the email can also be view in the communications feature of the website. I store additional details within the ItemProperties of a MailItem, these details are basically things like the id of the user the email relates to within a website.
The problem I'm having is any ItemProperties I add to a MailItem are being printed when the email is printed. Does anyone know how to exclude custom ItemProperties when printing an email?
Here is the code that is creating the custom ItemProperty:
// Try and access the required property.
Microsoft.Office.Interop.Outlook.ItemProperty property = mailItem.ItemProperties[name];
// Required property doesnt exist so we'll create it on the fly.
if (property == null) property = mailItem.ItemProperties.Add(name, Microsoft.Office.Interop.Outlook.OlUserPropertyType.olText);
// Set the value.
property.Value = value;
I'm working on Outlook extension and sometimes ago we had the same issue.
One of our team members found a solution. You can create some method which is responsible for disable printing. You can see peace of our code below:
public void DisablePrint()
{
long printablePropertyFlag = 0x4; // PDO_PRINT_SAVEAS
string printablePropertyCode = "[DispID=107]";
Type customPropertyType = _customProperty.GetType();
// Get current flags.
object rawFlags = customPropertyType.InvokeMember(printablePropertyCode , BindingFlags.GetProperty, null, _customProperty, null);
long flags = long.Parse(rawFlags.ToString());
// Remove printable flag.
flags &= ~printablePropertyFlag;
object[] newParameters = new object[] { flags };
// Set current flags.
customPropertyType.InvokeMember(printablePropertyCode, BindingFlags.SetProperty, null, _customProperty, newParameters);
}
Make sure that _customProperty it is your property which you created by the following code: mailItem.ItemProperties.Add(name,Microsoft.Office.Interop.Outlook.OlUserPropertyType.olText);
On the low (Extended MAPI) level, each user property definition has a flag that determines whether it is printable (namely, PDO_PRINT_SAVEAS). That flag however is not exposed through the Outlook Object Model.
You can either parse the user properties blob and manually set that flag (user properties blob format is documented, and you can see it in OutlookSpy (I am its author) if you click the IMessage button) or you can use Redemption (I am also its author) and its RDOUserProperty.Printable property.
The following script (VB) will reset the printable property for all user propeties of the currently selected message:
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Msg = Session.GetMessageFromID(Application.ActiveExplorer.Selection(1).EntryID)
for each prop in Msg.UserProperties
Debug.Print prop.Name
prop.Printable = false
next
Msg.Save