privatestaticvoid doTest(String algo, SecretKey skey,
AlgorithmParameterSpec params) throws Exception { // // Clone an uninitialized Mac object //
Mac mac = Mac.getInstance(algo, "SunJCE");
Mac macClone = (Mac)mac.clone();
System.out.println(macClone.getProvider().toString());
System.out.println(macClone.getAlgorithm()); boolean thrown = false; try {
macClone.update((byte)0x12);
} catch (IllegalStateException ise) {
thrown = true;
} if (!thrown) { thrownew Exception("Expected IllegalStateException not thrown");
}
// // Clone an initialized Mac object //
mac = Mac.getInstance(algo, "SunJCE");
mac.init(skey, params);
macClone = (Mac)mac.clone();
System.out.println(macClone.getProvider().toString());
System.out.println(macClone.getAlgorithm());
mac.update((byte)0x12);
macClone.update((byte)0x12); byte[] macFinal = mac.doFinal(); byte[] macCloneFinal = macClone.doFinal(); if (!java.util.Arrays.equals(macFinal, macCloneFinal)) { thrownew Exception("ERROR: MAC result of init clone is different");
} else System.out.println("MAC check#1 passed");
// // Clone an updated Mac object //
mac.update((byte)0x12);
macClone = (Mac)mac.clone();
mac.update((byte)0x34);
macClone.update((byte)0x34);
macFinal = mac.doFinal();
macCloneFinal = macClone.doFinal(); if (!java.util.Arrays.equals(macFinal, macCloneFinal)) { thrownew Exception("ERROR: MAC result of updated clone is different");
} else System.out.println("MAC check#2 passed");
}
}
Messung V0.5 in Prozent
¤ 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.10Bemerkung:
(vorverarbeitet am 2026-06-10)
¤
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.