Java Code Examples for sun.security.util.SignatureUtil#initVerifyWithParam()
The following examples show how to use
sun.security.util.SignatureUtil#initVerifyWithParam() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SignatureGetInstance.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static void testSetAndInit(String provName, Key key, boolean shouldPass) throws Exception { Signature sig; if (provName == null) { sig = Signature.getInstance(SIGALG); } else { sig = Signature.getInstance(SIGALG, provName); } AlgorithmParameterSpec params = PSSParameterSpec.DEFAULT; boolean doSign = (key instanceof PrivateKey); try { if (doSign) { SignatureUtil.initSignWithParam(sig, (PrivateKey)key, params, null); } else { SignatureUtil.initVerifyWithParam(sig, (PublicKey)key, params); } if (!shouldPass) { throw new RuntimeException("Fail: should throw InvalidKeyException"); } checkName(sig, provName); // check that the earlier parameter is still there if (sig.getParameters() == null) { throw new RuntimeException("Fail: parameters not preserved"); } } catch (InvalidKeyException ike) { if (shouldPass) { System.out.println("Fail: Unexpected InvalidKeyException"); throw ike; } } }
Example 2
Source File: SignatureGetInstance.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private static void testSetAndInit(String provName, Key key, boolean shouldPass) throws Exception { Signature sig; if (provName == null) { sig = Signature.getInstance(SIGALG); } else { sig = Signature.getInstance(SIGALG, provName); } AlgorithmParameterSpec params = PSSParameterSpec.DEFAULT; boolean doSign = (key instanceof PrivateKey); try { if (doSign) { SignatureUtil.initSignWithParam(sig, (PrivateKey)key, params, null); } else { SignatureUtil.initVerifyWithParam(sig, (PublicKey)key, params); } if (!shouldPass) { throw new RuntimeException("Fail: should throw InvalidKeyException"); } checkName(sig, provName); // check that the earlier parameter is still there if (sig.getParameters() == null) { throw new RuntimeException("Fail: parameters not preserved"); } } catch (InvalidKeyException ike) { if (shouldPass) { System.out.println("Fail: Unexpected InvalidKeyException"); throw ike; } } }
Example 3
Source File: SetNullSigParams.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { Signature sig = new SpecialSigImpl(); SignatureUtil.initVerifyWithParam(sig, (PublicKey) null, null); SignatureUtil.initSignWithParam(sig, null, null, null); }
Example 4
Source File: SetNullSigParams.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { Signature sig = new SpecialSigImpl(); SignatureUtil.initVerifyWithParam(sig, (PublicKey) null, null); SignatureUtil.initSignWithParam(sig, null, null, null); }