Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9186069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:26:03+00:00 2026-06-17T19:26:03+00:00

I have a private/public secure cert. My Java counterparts have the public key. I

  • 0

I have a private/public secure cert. My Java counterparts have the public key. I have the need to take a string, sign it, and send it along to Java to then verify the data and signature.

There appears to be a well known issue with how Microsoft and the rest of the world encodes/signs data, something about the way bytes are handled. It’s so well known, that I can’t find a solution. If they take my string and the private key, they can obviously sign it correctly, and verify it. If I take my string, I can sign and verify it within .Net fine. I have seen a slew of methods for converting from ASN1 to Microsoft’s format (I think P1363), but not converting from Microsoft, C#, to ASN1 for Java. I don’t what is going on well enough to understand how to reverse engineer.

I’ve explored http://www.codeproject.com/Articles/25487/Cryptographic-Interoperability-Keys but the final result wasn’t what the java side needed. I can sign a string, and I get a signature, but Java guys are telling me it needs to start with MC, first bytes are indicators. I am not seeing this.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T19:26:04+00:00Added an answer on June 17, 2026 at 7:26 pm

    A solution has been found, and looks like some of the other examples I’ve been seeing, but for some reason this works better: (method named after the guy who solved it for me 😉

                private static byte[] Rays(byte[] sigBytes)
                {
                    bool highMsbR = (sigBytes[0] & 0x80) != 0;
                    bool highMsbS = (sigBytes[20] & 0x80) != 0;  
    
                    MemoryStream stream = new MemoryStream();
                    using (BinaryWriter writer = new BinaryWriter(stream))
                    {
                        writer.Write((byte)0x30);
                        int len = 44 + (highMsbR ? 1 : 0) + (highMsbS ? 1 : 0);
                        writer.Write((byte)len);
    
                        // r
                        writer.Write((byte)0x02);
                        writer.Write((byte)(highMsbR ? 21 : 20));
                        if (highMsbR)
                            writer.Write((byte)0); 
                        for (int i = 0; i < 20; i++)
                            writer.Write(sigBytes[i]); 
    
                        // s
                        writer.Write((byte)0x02);
                        writer.Write((byte)(highMsbS ? 21 : 20));
                        if (highMsbS)
                            writer.Write((byte)0);
                        for (int i = 20; i < 40; i++)
                            writer.Write(sigBytes[i]);
                    }
    
                    byte[] bytes = stream.ToArray();
                    return bytes;
                }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a public/private key pair set up so I can ssh to a
I have public and private keys in separate .pem files that I would need
I have the following class: private class NodeTemp { public string Content; public NodeTemp
I have the following beans: public class CodedEntity { private String name; private String
I have a private static readonly field in my class: public class MyClass {
I have the following struct private struct sData{ public int volume; public System.Timers.Timer aliveTimer;
If I have: class Test { private Vector2 v; public Vector2 Velocity { get
I have written a sample application to write to a public and private queues
This is the definitions I have in the private SavePreferenceCallback savePreferenceHandler; public SavePreferenceCallback SavePreferenceHandler
I have a List<MyClass> The class is like this: private class MyClass { public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.