[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bouncycastle-crypto-dev
Subject:    Re: [dev-crypto] Finding OID for algorithm names and vice versa
From:       David Hook <dgh () autochthonous ! org>
Date:       2014-01-29 23:07:40
Message-ID: 52E989BC.2000005 () autochthonous ! org
[Download RAW message or body]

Oops! Yes, those are the ones.

Regards,

David

On 30/01/14 08:41, Daniil Ivanov wrote:
> Thank you for the reply!
>
> Do you mean DefaultSignatureAlgorithmIdentifierFinder and 
> DefaultDigestAlgorithmIdentifierFinder?
>
> Thanks, Daniil
>
>
> On Wed, Jan 29, 2014 at 12:33 AM, David Hook <dgh@autochthonous.org 
> <mailto:dgh@autochthonous.org>> wrote:
>
>
>     There are a few helper classes in the PKIX distribution which are
>     specifically for dealing with this.
>
>     Have a look in org.bouncycastle.operator -
>     DefaultDigestAglorithmIdentifierProvider and
>     DefaultSignatureAlgorithmIdentifierProvider. There's also a few
>     others in different places through the rest of the distribution.
>
>     Regards,
>
>     David
>
>
>     On 28/01/14 23:03, Daniil Ivanov wrote:
>>     Hi,
>>
>>      I have to perform conversions between cryptography algorithms
>>     names and their object
>>      identifiers  (OIDs). And I was thinking, as I rely on JCA and
>>     BouncyCastle as JCA
>>      security provider, it would be very right to delegate this job
>>     to them.
>>
>>      Converting OIDs to textual names is fairly easy with JCA itself:
>>     |  String  oid=  "2.16.840.1.101.3.4.2.4";
>>       MessageDigest  md=  MessageDigest.getInstance(oid);
>>
>>       String  digestAlgorithmName=  md.getAlgorithm();|
>>
>>      But converting textual names back to OIDs appears to be
>>     non-trivial task.
>>
>>      I was asking this question  on StackoOverflow, however, didn't
>>     get any useful reply
>>     http://stackoverflow.com/q/21191499/642653
>>
>>      There is my own solution by parsing textual description of JCA
>>     Provider's Service
>>      to get OID. But this is really ugly.
>>
>>      Is there anything in BouncyCastle I missed, but could help to
>>     deal with this problem?
>>
>>     Thanks, Daniil
>
>


[Attachment #3 (text/html)]

<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix"><br>
      Oops! Yes, those are the ones.<br>
      <br>
      Regards,<br>
      <br>
      David<br>
      <br>
      On 30/01/14 08:41, Daniil Ivanov wrote:<br>
    </div>
    <blockquote
cite="mid:CAGm_y0RkeZ6x7eWVAErtJy_ZSiOnsfe5f4GhqtGZn8ASZyokwA@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>Thank you for the reply!<br>
          <br>
          Do you mean DefaultSignatureAlgorithmIdentifierFinder and
          DefaultDigestAlgorithmIdentifierFinder?<br>
          <br>
        </div>
        Thanks, Daniil<br>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">
          On Wed, Jan 29, 2014 at 12:33 AM, David Hook <span dir="ltr">&lt;<a
              moz-do-not-send="true" href="mailto:dgh@autochthonous.org"
              target="_blank">dgh@autochthonous.org</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="#FFFFFF" text="#000000">
              <div><br>
                There are a few helper classes in the PKIX distribution
                which are specifically for dealing with this.<br>
                <br>
                Have a look in org.bouncycastle.operator -
                DefaultDigestAglorithmIdentifierProvider and
                DefaultSignatureAlgorithmIdentifierProvider. There's
                also a few others in different places through the rest
                of the distribution.<br>
                <br>
                Regards,<br>
                <br>
                David
                <div>
                  <div class="h5"><br>
                    <br>
                    On 28/01/14 23:03, Daniil Ivanov wrote:<br>
                  </div>
                </div>
              </div>
              <div>
                <div class="h5">
                  <blockquote type="cite">
                    <div dir="ltr">
                      <div>
                        <div>Hi,<br>
                          <br>
                          &nbsp;I have to perform conversions between
                          cryptography algorithms names and their object<br>
                          &nbsp;identifiers&nbsp; (OIDs). And I was thinking, as I
                          rely on JCA and BouncyCastle as JCA<br>
                          &nbsp;security provider, it would be very right to
                          delegate this job to them.<br>
                          <br>
                        </div>
                        &nbsp;Converting OIDs to textual names is fairly easy
                        with JCA itself:
                        <pre><code><span> String</span><span> oid \
</span><span>=</span><span> \
</span><span>"2.16.840.1.101.3.4.2.4"</span><span>;</span><span> </span><span> \
MessageDigest</span><span> md </span><span>=</span><span> \
</span><span>MessageDigest</span><span>.</span><span>getInstance</span><span>(</span><span>oid</span><span>);</span><span>


</span><span> String</span><span> digestAlgorithmName </span><span>=</span><span> \
md</span><span>.</span><span>getAlgorithm</span><span>();</span></code></pre>  \
<p>&nbsp;But converting textual names back to OIDs  appears to be non-trivial \
task.<br>  </p>
                        &nbsp;I was asking this question&nbsp; on StackoOverflow,
                        however, didn't get any useful reply<br>
                      </div>
                      <div>&nbsp;<a moz-do-not-send="true"
                          href="http://stackoverflow.com/q/21191499/642653"
                          \
target="_blank">http://stackoverflow.com/q/21191499/642653</a><br>  &nbsp;<br>
                      </div>
                      <div>&nbsp;There is my own solution by parsing textual
                        description of JCA Provider's Service<br>
                      </div>
                      <div>&nbsp;to get OID. But this is really ugly.<br>
                        <br>
                        &nbsp;Is there anything in BouncyCastle I missed, but
                        could help to deal with this problem?<br>
                      </div>
                      <br>
                      Thanks, Daniil<br>
                    </div>
                  </blockquote>
                  <br>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic