How to change UTf8_STRING encoding to Printable_STRING in bouncy castle - windows-phone-8

We are implementing Windows MDM. In this,we we generate X509Certificate device certificate from PKCS#10 CSR(obtained from device in previuos request) using BC library.
Now problem is subject property of device cert has UTF8_STRING encoding and I want to override it to PRINTABLE_STRING.
I need to override behavior of BC library to use ASN.1 type: PRINTABLE_STRING.
But I am not getting way to do it.

Related

Cast function + DRM

I have a question regarding combination of Google Cast + DRM Streaming.
What we have:
Google Cast “Sender App” feature inside our mobile app that sends stream to TV
without implementing a “Receiver App” logic inside our TV app, because we want to use default Cast logic.
It works for open streams (without DRM).
And doesn’t work for DRM Streams.
Looks like we cannot implement simple “Sender App” for DRM Streams.
Documentation reference:
"However, if you would like to Cast DRM protected content, you should build and host your own Web Receiver" from https://developers.google.com/cast/docs/android_sender/exoplayer
Question:
Are there any successfull examples of Cast implementation among without a custom “Receiver App”?
Thanks!
Yes there are, I implemented the casting feature using the exoplayer cast extension. There isn't so much documentation on it but the exoplayer github repo helped me implement it. https://github.com/google/ExoPlayer/tree/release-v2/extensions/cast

Is there a way to force the UWP RichEditBox use only UTF encoding when the user types?

I am trying to convert the contents of a UWP RichEditBox to HTML.
For that purpose, I've tried using the RtfPipe library (https://github.com/erdomke/RtfPipe). From the looks of it, this library has a problem on UWP, due to the fact that not all encodings are defined on that target framework. (This is the error you get, if you are interested: Encoding.GetEncoding can't work in UWP app, but the accepted answer seems not to be the best option on all platforms - I haven't even managed to make the suggested fix compile, so it might not be valid anymore)
Now, as a way of avoiding this from happening, I am wondering whether there is a way to force the control to always use one of the UWP-defined UTF-variants for encoding the data when the user types his text.
Because, now, when I type into it, I get things like that:
{\rtf1\fbidis\ansi\ansicpg1253\deff0\nouicompat\deflang1032{
....
\pard\tx720\cf1\f0\fs23\lang1033
...that make the library throw exceptions.
I guess, if I manage to make it not use ASCII code pages, things will be great.
After taking a look at the control properties though, I do not see something I could use. Is there any way to achieve this?
This is the error you get, if you are interested: Encoding.GetEncoding can't work in UWP app
As you described, there is an inner error thrown when using this package with UWP app. System.ArgumentException: 'Windows-1252' is not a supported encoding name, by testing on my side, which is thrown by the code line public static readonly Encoding AnsiEncoding = Encoding.GetEncoding("Windows-1252"); of RtfSpec.cs when UpdateEncoding.
It seems like Windows-1252 may not be supported in UWP from the error details,also see this similar thread. You could use UTF instead as you want, for example, have a change on the library with following then it will work (testing demo here).
public static readonly Encoding AnsiEncoding = Encoding.UTF8;
I haven't even managed to make the suggested fix compile, so it might not be valid anymore
Encoding.RegisterProvider method should be work, but it only support UWP or .NET Framework 4.6, it does't support the Portable Class Library. The RtfPipe library you mentioned is Portable Class Library, so that you cannot use Encoding.RegisterProvider. Encoding.GetEncoding method supports Portable Class Library, details please check the version information of the two classed.
I guess, if I manage to make it not use ASCII code pages
RTF itself uses the ANSI, PC-8, Macintosh, or IBM PC character set to control the representation and formatting of a document, you may not able to change that. Consider to update the library to resolve the issue for UWP.

How to instantiate H264 Encoder on WinRT Store App

I want to be able to encode video frames using Media Foundation IMFTransform for H264 Video Encoding. That's easily doable in Win32, where you can use MFTEnumEx to enumerate the transforms and find the H264 encoder.
However, on WinRT (Store Apps), I can't find a way to instantiate.
I've noticed there's a class CMSH264EncoderMFT, but there's no definition for the CLSID to use on CoCreateInstance.
With:
CoCreateInstance(CLSID_CMSH264EncoderMFT, nullptr, CLSCTX_INPROC_SERVER, __uuidof(IUnknown), (void **)&pUnknown);
CLSID_CMSH264EncoderMFT is undefined for WinRT apps.
And tried:
ComPtr<CMSH264EncoderMFT> encoder = Make<CMSH264EncoderMFT>();
It says the class CMSH264EncoderMFT is incomplete, and says "use of undefined type 'CMSH264EncoderMFT'". Don't even know if the syntax for Make is correct or appropriate...
Does anyone have a clue on how to do this for WinRT?
Use MFCreateSinkWriterFromURL to create a file writer first. Then, use MFCreateMediaType to create an IMFMediaType. Set up its properties, one of which will be the output format: use SetGUID method on the media type with MF_MT_SUBTYPE guid and specify MFVideoFormat_H264 as the argument. Finally, use AddStream method on the sink writer to set the media type to it.
There's an example here (you'll need to modify it a bit when it sets MF_MT_SUBTYPE).
you cannot instantiate object via CMSH264EncoderMFT because it DOES NOT have some interfaces which MUST have object in WinRT for example IInspectable - Provides functionality required for all Windows Runtime classes. CMSH264EncoderMFT IS NOT WinRT class. You can try resolve your task by function MFCreateSinkWriterFromMediaSink - this function takes an object with interface IMFMediaSink. It is possible write code for object with IMFMediaSink interface and receive samples from IMFTransform::ProcessOutput. I just point your attention - you cannot instantiate in WindowsStore code objects which IS NOT Windows Runtime classes.
Regards,
Evgeny Pereguda

What is the MvvmCross version of DeviceNetworkInformation.IsNetworkAvailable

I'm re-writing a Windows Phone app to make it cross platform using the excellent MvvmCross framework.
On Windows Phone I usually test DeviceNetworkInformation.IsNetworkAvailable to ensure I have a network connection before calling a REST service.
Is there a way of doing this in a cross-platform way using MvvmCross?
There is a cross-platform plugin Cirrious.MvvmCross.Plugins.Network specifically for Network functionality and this was originally built specifically to provide Reachability
However, sadly the WindowsPhone part of this isn't yet implemented! See https://github.com/MvvmCross/MvvmCross/blob/v3.1/Plugins/Cirrious/Network/Cirrious.MvvmCross.Plugins.Network.Phone/Plugin.cs
If you need Reachability within a cross-platform app including WindowsPhone, I'd probably opt for adding this Network plugin, and then also modifying your WindowsPhone Setup to register something like:
public class MyReachability : IMvxReachability
{
public bool IsHostReachable(string host)
return // something using DeviceNetworkInformation.IsNetworkAvailable
}
}
// registered in Setup using:
protected override void InitializeLastChance() {
base.InitializeLastChance();
Mvx.RegisterType<IMvxReachability, MyReachability>();
}
Longer term, I'd be happy to see a decent implementation pushed back into the MvvmCross repository.
Also linking this question to: MvvmCross Reachability on Windows Phone and Network state with mvvmcross?

Why do I get no warning when protocol methods are not specified?

Merged with Why do I get no warning when protocol methods are not specified?.
I'm using Xcode 4, have a simple class interface defined and I added NSTableViewDelegate and NSTableViewDataSource protocols to the interface definition. I.e,
#interface foo : NSObject < NSTableViewDelegate, NSTableViewDataSource>
In my build settings, I have confirmed that the option "Incomplete Objective-C Protocols" warning is enabled (for Debug/Any Architecture etc) and I should get a compile time warning for the non-optional methods required for the NSTableViewDataSource protocol. However, I get no warnings at all but then at runtime I see the message in the log that the methods aren't defined.
Anyone know why?