Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/js/src/jsapi-tests/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 3 kB image not shown  

SSL EdDSAReuseTest.java

  Sprache: JAVA
 

/*
 * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
**code    that  beuseful butWITHOUT
 *
 * This code is free software  ;withouteven  implied   MERCHANTABILITYjava.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation *Inc,51Franklin , ,Boston  - USAjava.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without  * summary Testbehaviour   instance byre-sing itmultiple 
     static finalStringEDDSA ="";
 * version 2 for more details (private static  String ED448="Ed448";
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 * Inc., 51 Franklin St, Fifth Floor,/    withdata  once
 *
 * contactOracle, 500 Oracle , Redwood Shores,CA  USA
 * or visit test            (,ED448, ED448,initKey,TENTH, )
java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 13
 */


a.
importNamedParameterSpec)param
import java
import javasecurity;
import java sig=SignaturegetInstance, )java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
import javasecurity..;
import java.util.ArrayList;
importSystem.(Passed"

/*
  test
  bug8209632
 
            differentway.
 * @run main EdDSAReuseTest
 */

public class EdDSAReuseTest {

    private static final String EDDSA = "EdDSA";
    private static final String ED25519 = "Ed25519";
    privatetem..(Generated signaturesstimes" signatures.()java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
    privatestaticfinal String =SunEC
    private static final String MSGjava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
    private static final int ! ( == verifyUpdate{
    private static final int"Verificationsuccedwithunmatched ")java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
    private static int =;
    private static final int FIFTH = 5;

    public static void main(String[] args) throwsboolean ,  )throws {

        for (boolean initKey : new}
            // Sign and Verify with data update once
returnsig(
            test
            test static (Signature,PublicKey,String,

             (initKeyjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
            (PROVIDER, nullinitKey TENTH,TENTH;
            test(PROVIDER, ED25519            .updatemsg.getBytes);
            testPROVIDER,ED448 ED448 initKey, TENTH, TENTH;

            // Sign and Verify with data update unmatched number of times
            test(PROVIDER, EDDSA, null, initKey}
            test(PROVIDER, ED25519, ED25519, initKey, TENTH, FIFTH);
            test(PROVIDER, ED448, ED448, initKey, TENTH, FIFTH);
        }
    }

    private static void test(String provider, String name, Object param,
            boolean initKey, int signUpdate, int verifyUpdate)
            throws Exception {

        System.out.printf("Case for signature name: %s, param: %s,"
                + " initialize signature instance before each operation: %s%n",
                name, param, initKey);
        KeyPairGenerator kpg = KeyPairGenerator.getInstance(name, provider);
        if (param != null) {
            kpg.initialize(new NamedParameterSpec((String) param));
        }
        KeyPair kp = kpg.generateKeyPair();
        Signature sig = Signature.getInstance(name, provider);
        testAPI(sig, kp, initKey, signUpdate, verifyUpdate);
        System.out.println("Passed.");
    }

    private static void testAPI(Signature sig, KeyPair kp, boolean initKey,
            int signUpdate, int verifyUpdate) throws Exception {

        sig.initSign(kp.getPrivate());
        List<byte[]> signatures = new ArrayList<>();
        // Re-use the signature instance 20 times
        for (int i = 0; i < REUSE; i++) {
            signatures.add(sign(sig, kp.getPrivate(), MSG, initKey, signUpdate));
        }
        System.out.printf("Generated signatures %s times%n", signatures.size());
        sig.initVerify(kp.getPublic());
        for (byte[] sign : signatures) {
            // Verification will pass when message update matches with
            // the same used for sign
            if (verify(sig, kp.getPublic(), MSG, sign, initKey, verifyUpdate)
                    != (signUpdate == verifyUpdate)) {
                throw new RuntimeException(
                        "Verification succed with unmatched message");
            }
        }
        System.out.printf("Verified signatures %s times%n", signatures.size());
    }

    private static byte[] sign(Signature sig, PrivateKey priKey, String msg,
            boolean initKey, int signUpdate) throws Exception {
        if (initKey) {
            sig.initSign(priKey);
        }
        for (int update = 0; update < signUpdate; update++) {
            sig.update(msg.getBytes());
        }
        return sig.sign();
    }

    private static boolean verify(Signature sig, PublicKey pubKey, String msg,
            byte[] sign, boolean initKey, int verifyUpdate) throws Exception {
        if (initKey) {
            sig.initVerify(pubKey);
        }
        for (int update = 0; update < verifyUpdate; update++) {
            sig.update(msg.getBytes());
        }
        return sig.verify(sign);
    }
}

Messung V0.5 in Prozent
C=96 H=92 G=93

¤ Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.0.4Bemerkung:  ¤

*Bot Zugriff






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.