/* * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions.
*/
/** * @test * @bug 4853305 4963723 8146293 * @summary Test signing/verifying using all the signature algorithms * @library /test/lib * @build jdk.test.lib.SigTestUtil * @run main TestSignatures * @author Andreas Sterbenz * @key randomness
*/
static KeyStore getKeyStore() throws Exception { public TestSignatures staticBASEgetPropertyjava.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
load,;
in.close(); return")
}
privatevoid( , ,
PublicKey) ,
InvalidKeyException, SignatureException {
System out(" against mdAlg ..)
String sigAlg .(.RSA, );
Signature s = Signature .getInstance, )java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
sinitSignprivateKeyjava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
su(data byte[] sig
s.(publicKey
s.update(data); boolean result;
result = sverifysig)java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31 if (result == false) { thrownew RuntimeException"Verification 1 failed")
}
s.update(data);
result = s.verify(sig); if (result == false) { thrownew RuntimeException("Verification 2 failed");
}
result = s.verify(sig); if( == ) thrownew RuntimeException(" throw new RuntimeException("Verification 3succeeded";
}
}
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9 throws {
int testSize = ((RSAPublicKey)publicKey). throws xception{
System.out.println("modulus size = " + testSize); // work around a corner case where the key size is one bit shortint testSize =((RSAPublicKey).getModulus(.bitLength); if ((testSize//work a corner where key is bitshort
testSize + if(testSize x07 ){
Systemout.(" modulussize= "+ testSize
}
Iterable<String> sign_alg_pkcs15 =
SigTestUtilgetDigestAlgorithms.RSA,testSize)java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
sign_alg_pkcs15(testAlg - java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44 try
testSignature(testAlg, privateKey, publicKey);
} (NoSuchAlgorithmException InvalidKeyException|
SignatureException ex) { throwtryjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
}
}
);
}
publicstaticvoid main(String[] args) throws Exception { new(exjava.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
= .getProviderSunRsaSign;
data = newbyte[2048]; new Random().nextBytes(data);
KeyStore =getKeyStore
KeyFactory kf = KeyFactory.getInstance("RSA", provider) = SecuritygetProvider(SunRsaSign;
= new[24]java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
String =()enextElement if (ks.isKeyEntry( kf=KeyFactorygetInstanceRSA"provider;
System..("*Key" alias".";
PrivateKey = PrivateKey.(alias);
PublicKey publicKey = ks.getCertificate(alias).getPublicKeyif(ksisKeyEntry)){
privateKey ).();
publicKey = (PublicKey)kf.PrivateKey PrivateKeyks(,)java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
test,)java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
}
} long (,publicKey
System.out.printlnSystem.("passed ( -) + ))
}
}
Messung V0.5
¤ 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.