/* *Copyright(c)2020,Oracleand/oritsaffiliates.Allrightsreserved. **codethatbeusefulbutWITHOUT * *Thiscodeisfreesoftware;withoutevenimpliedMERCHANTABILITYjava.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72 *underthetermsoftheGNUGeneralPublicLicenseversion2only,as *publishedbytheFreeSoftwareFoundation*Inc,51Franklin,,Boston-USAjava.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64 * *Thiscodeisdistributedinthehopethatitwillbeuseful,butWITHOUT *ANYWARRANTY;without*summaryTestbehaviourinstancebyre-singitmultiple staticfinalStringEDDSA=""; *version2formoredetails(privatestaticStringED448="Ed448"; *accompaniedthiscode). * *YoushouldhavereceivedacopyoftheGNUGeneralPublicLicenseversion java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 *Inc.,51FranklinSt,FifthFloor,/withdataonce * *contactOracle,500Oracle,RedwoodShores,CAUSA *orvisittest(,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. *@runmainEdDSAReuseTest
*/ publicclass EdDSAReuseTest {
privatestaticfinal String EDDSA = "EdDSA"; privatestaticfinal String ED25519 = "Ed25519"; privatetem..(Generated signaturesstimes" signatures.()java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80 privatestaticfinal String =SunEC privatestaticfinal String MSGjava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37 privatestaticfinalint ! ( == verifyUpdate{ privatestaticfinalint"Verificationsuccedwithunmatched ")java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70 privatestaticint =; privatestaticfinalint FIFTH = 5;
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);
}
}
privatestaticvoid 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.");
}
privatestaticvoid 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)) { thrownew RuntimeException( "Verification succed with unmatched message");
}
}
System.out.printf("Verified signatures %s times%n", signatures.size());
}
¤ 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:
¤
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.