Is there an example of how to do a XAdES-BES enveloped signature with the XAdES4j library? - xades4j

I'm trying to use the XAdES4j library to sign xml with an enveloped signature. From everything I've read it looks like it is possible to do exactly what I'd like to do, but I've not been able to find a simple example to help me to understand the workflow better. The library is found here:
https://github.com/luisgoncalves/xades4j
It includes a wiki, but the wiki does not give a clear example. It refers you to the unit tests in the code. However, in the code for the unit tests, there are numerous methods that do not exist in the main code stream. I'm looking for a simple example for a XAdES-BES enveloping signature to be added to xml given these variables:
The path to my xml file: /path/to/xml/myXmlFile.xml
The root element in my xml file: invoice
The path to my cert: /path/to/cert/myCert.p12
Password to my cert: "myPassword"
Can anybody help me out with a clear example?
Thanks so much in advance :)

Here's a full example provided by another user within an issue in GitHub. It illustrates both XAdES-BES and XAdES-T.
On the project's wiki you have detail instructions on which classes need to be used and pointers to more detailed information.
Regarding the unit tests, there are some common/helper methods on the base classes that can be useful in other scenarios, namely on SignatureServicesTestBase and SignerTestBase
Hope this helps.

Related

TypeScript Definitions for Forge Viewer missing getFragmentProxy

I'm using typescript definitions for Forge in link below:
https://forge.autodesk.com/blog/typescript-definitions-forge-viewer-and-nodejs-client-sdk-now-available
When I try to transform the model following this article:
https://forge.autodesk.com/blog/know-how-complex-component-transformations-viewer-part-1-basics, I realize viewerimpl is missing method getFragmentProxy.
How can I fix this?
Thank you for letting us know. This issue is caused by the missing type definition for the Viewer3DImpl#getFragmentProxy in the community contributed TypeScript definition file for the Forge Viewer (i.e. #types/forge-viewer) under DefinitelyTyped repository, so the TypeScript type checker/complier cannot find the type definition. The method is still there in the Forge Viewer JavaScript libs. To fix it, here are some suggestions for you:
Create an PR for adding the missing type definition of the Viewer3DImpl#getFragmentProxy on DefinitelyTyped repository yourself
Create a dummy .d.ts file to add the missing type definition somewhere in your code project. Please refer here for How-To (Link1 & Link2)
Wait for updates on #types/forge-viewer from us (Not recommended, it might take some time for one line code update)

Link to Source Code from TypeDoc Documentation

I've documented a function and I can see that the generator has captured the line number:
Is it possible to configure TypeDoc so that a user can click through to see the actual source code? The full repository is here.
There is a TypeDoc plugin that might address your problem:
https://github.com/gdelmas/typedoc-plugin-sourcefile-url
It doesn't work for my situation because for some reason the URLs to the GitHub source I'm connecting to must contain blob/master, which this plugin doesn't add. But I add it here in case it's useful to you.

Convert custom tiny-YOLOv3 to a tensorflow format

After having tried all solutions I have found on every github, I couldn't find a way to convert a customly trained YOLOv3 from darknet to a tensorflow format (keras, tensorflow, tflite)
By custom I mean:
I changed the number of class to 1
I set the image size to 576x576
I set the number of channels to 1 (grayscale images)
So far I am happy with the results on darknet, but for my application I need TFlite and I can't find working method for conversion that suits my case.
Anyone have succeed in doing something similar?
Thank you.
Do you have the resulting .weights file for your custom model?
If so, the following project by peace195 may help:
https://github.com/peace195/tensorflow-lite-YOLOv3
EDIT:
In the above link, use convert_weights_pb.py file to convert your .weights file to a .pb file.
Then use the .pb file as a saved model and convert it to a .tflite model using the following command.
tflite_convert --saved_model_dir=saved_model/ --output_file yolo_v3.tflite --saved_model_signature_key='predict'
Thanks Anton Menshov for your suggestion on improving the answer.
This is the most simplest and easy repo. Author has done a wonderful job and it works well with yolov3, yolv3-tiny and yolov-4. Please don't forget to change the coco.names under classes if you are training on custom classes.
Git link for the code

Class file editor : Source not found error for ILock, ClassPathSuite classes

I am getting Class file editor : Source not found error for the classes in junit / hazelcast packages. Previously i got this error for all built in java classes. But after adding the Source zip file, i am able to see String.class and all. What i need to do for these classes. Please find the screenshot
Thanks in Advance!
Interestingly enough, your question contains all the concepts you need to know in order to answer it.
In order for your IDE to show you source code for any library you are using, the corresponding library needs to come with source code attached to it.
In other words: you managed to point your IDE to the ZIP file containing the source code for your JRE/JDK - thus your IDE knows what to show you when want to open up String.class
Now it seems that you are using other libraries as well. Maybe maybe, other libraries, have other, different source code ZIP files?!
Long story short: you need to add "source code" ZIPs for each and any additional library you are using and that you want to "peek into".
Within eclipse, you achieve that for example as described in that SO q/a. Side note: that is also something to keep in mind: you should do prior research before coming up with "new" questions. Especially when you are a beginner, you can be very sure that "your" question was asked here before.

Uploading a file using TCL

I'm a newbie working on OpenACS architecture and need to upload a .xml file through TCL. I went through the documentation and tried to work around with the code mentioned here: http://wiki.tcl.tk/13675
However, I'm unable to understand the code and the copy-paste won't work. Could someone please suggest a easier working way to upload a file in TCL? A working code would be of great help.
I need to upload a file through a HTTP form(with input type file parameter) and I'm asking for server-side code.
OpenACS already has file uploading built in (assuming you're using the OpenACS form builder aka ad_form, template::form - it has many names!). The specific widget you need to use is template::widget::file
A worked example is in the General Comments package (see file-ae.adp, file-add.tcl and file-add-2.tcl):
http://cvs.openacs.org/browse/OpenACS/openacs-4/packages/general-comments/www/file-ae.adp?r=1.6
http://cvs.openacs.org/browse/OpenACS/openacs-4/packages/general-comments/www/file-add.tcl?r=1.4
http://cvs.openacs.org/browse/OpenACS/openacs-4/packages/general-comments/www/file-add-2.tcl?r=1.6
Specifically, look out for the 2 ad_page_contract parameters, and follow those variables down through the code:
upload_file:notnull
upload_file.tmpfile:tmpfile
Re-inventing network protocols is not so much worth in most cases, so I'd like to recommend using proven community libs. From my personal experience, I'm pretty glad to deal with libcurl (see http://curl.haxx.se/libcurl/tcl)