GCM or CCM implementation of C# - c#

Can any one point me to any live implementation of CBC-MAC Mode (CCM)or Galois/Counter Mode (GCM) in C#?
It seems that Microsoft has not created any implementation similar to AesCryptoServiceProvider. Am I right?
I did went through: https://blogs.msdn.microsoft.com/shawnfa/2009/03/17/authenticated-symmetric-encryption-in-net/, bit it's more of a "would look something like" rather than actual implementation.
Any help will be highly appreciated.
Thanks in advance.

By the way, while there wasn't an official MS implementation at the time of this question, there is one now:
AES-GCM: AesGcm Class (System.Security.Cryptography)
AES-CCM: AesCcm Class (System.Security.Cryptography)
Both are supported from:
.Net: 5.0
.Net Core: 3.0
.Net Standard 2.1

Related

TypedActor vs ReceiveActor?

Most documentation refers to using ReceiveActor and then methods such as Receive(). However, some documentation refers to inheriting from TypedActor and then using interfaces such as IHandle<MyMessageType>.
Is it safe [as in, best practice/not deprecated] to use TypedActor + Interfaces or should I only be using ReceiveActor? (Official documentation seems to be unclear on the subject)
TypedActor will be marked as obsolete in version 1.3, and will be removed in version 1.5 (relevant pull request and issue).
There was a discussion a few years ago (as tomliversidge says in their answer) to rename it, but that plan didn't go ahead.
There is some discussion here with regards to this. Seems like it is being made obsolete in the Java/Scala Akka world so I'd probably stick to ReceiveActor unless TypedActor gives you something ReceiveActor doesn't

Where can be ECDsaCryptoServiceProvider class found

I've been following this sample about singing xml documents with c# using RSACryptoServiceProvider.
What I need is to use this sample with ECDsaCryptoServiceProvider, found here:
http://msdn.microsoft.com/en-us/library/system.security.cryptography.ecdsacryptoserviceprovider%28v=vs.102%29.aspx
As msdn say, it should be found under System.Security.Cryptography, the problem is that I cannot see that class under System.Security.Cryptography.
Does someone knows how can I use that class? Should I use a "special" version of .net framework? Thanks in advance.
Only ".NET Micro Framework 4.3"
This is for microcontroler-devices before the IOT-wave came out.

How to access System.getProperties() when you have converted java project to .Net

I am trying to use HTMLUnit in .Net I followed the example in Steven Sanderson's blog http://blog.stevensanderson.com/2010/03/30/using-htmlunit-on-net-for-headless-browser-automation/ which works well. However I have encontered the problem mentioned in How to disable runtime warnings in java? where I want to turn down the noise from Log4J.
As stated I need to do the following:-
System.getProperties().put("org.apache.commons.logging.simplelog.defaultlog","fatal");
But I have no idea how to do this in .Net. Any help would be much appreciated.
Simon
The config system is .NET considerably different to that in Java (he said, not having written any Java for over 10 years!). Take a look here to get you started : http://msdn.microsoft.com/en-us/library/system.configuration.configurationsettings.aspx
You can also write custom config sections/handler for more complex bespoke config scenarios. http://msdn.microsoft.com/en-us/library/ie/2tw134k3.aspx

Need your help on Full Triple DES MAC in C# .NET

My work needs the full triple DES MAC function in .NET (as as defined in [ISO 9797-1] as MAC Algorithm 1 with output transformation 1, without truncation, and with triple DES taking the place of the block cipher)
My problem is that I don't know how to implement this algorithm in C#.NET
Is there any suggestion (or code snippet) that would helps me implementing it (.NET Class and method)
Thanks in advance!
Best regards,
Hai-Binh LE
The .Net Library already contains an implementation of the TripleDES Message Authenticator Code algorithm.
You can find the documentation and example here.
You didn't mention which version of the .net framework you were using, incidentally, so I've assumed 3.5 here.

Lex/Yacc for C#?

Actually, maybe not full-blown Lex/Yacc. I'm implementing a command-interpreter front-end to administer a webapp. I'm looking for something that'll take a grammar definition and turn it into a parser that directly invokes methods on my object. Similar to how ASP.NET MVC can figure out which controller method to invoke, and how to pony up the arguments.
So, if the user types "create foo" at my command-prompt, it should transparently call a method:
private void Create(string id) { /* ... */ }
Oh, and if it could generate help text from (e.g.) attributes on those controller methods, that'd be awesome, too.
I've done a couple of small projects with GPLEX/GPPG, which are pretty straightforward reimplementations of LEX/YACC in C#. I've not used any of the other tools above, so I can't really compare them, but these worked fine.
GPPG can be found here and GPLEX here.
That being said, I agree, a full LEX/YACC solution probably is overkill for your problem. I would suggest generating a set of bindings using IronPython: it interfaces easily with .NET code, non-programmers seem to find the basic syntax fairly usable, and it gives you a lot of flexibility/power if you choose to use it.
I'm not sure Lex/Yacc will be of any help. You'll just need a basic tokenizer and an interpreter which are faster to write by hand. If you're still into parsing route see Irony.
As a sidenote: have you considered PowerShell and its commandlets?
Also look at Antlr, which has C# support.
Still early CTP so can't be used in production apps but you may be interested in Oslo/MGrammar:
http://msdn.microsoft.com/en-us/oslo/
Jison is getting a lot of traction recently. It is a Bison port to javascript. Because of it's extremely simple nature, I've ported the jison parsing/lexing template to php, and now to C#. It is still very new, but if you get a chance, take a look at it here: https://github.com/robertleeplummerjr/jison/tree/master/ports/csharp/Jison
If you don't fear alpha software and want an alternative to Lex / Yacc for creating your own languages, you might look into Oslo. I would recommend you to sit through session recordings of sessions TL27 and TL31 from last years PDC. TL31 directly addresses the creation of Domain Specific Languages using Oslo.
Coco/R is a compiler generator with a .NET implementation. You could try that out, but I'm not sure if getting such a library to work would be faster than writing your own tokenizer.
http://www.ssw.uni-linz.ac.at/Research/Projects/Coco/
I would suggest csflex - C# port of flex - most famous unix scanner generator.
I believe that lex/yacc are in one of the SDKs already (i.e. RTM). Either Windows or .NET Framework SDK.
Gardens Point Parser Generator here provides Yacc/Bison functionality for C#. It can be donwloaded here. A usefull example using GPPG is provided here
As Anton said, PowerShell is probably the way to go. If you do want a lex/ yacc implementation then Malcolm Crowe has a good set.
Edit: Direct Link to the Compiler Tools
Just for the record, implementation of lexer and LALR parser in C# for C#:
http://code.google.com/p/naive-language-tools/
It should be similar in use to Lex/Yacc, however those tools (NLT) are not generators! Thus, forget about speed.

Categories

Resources