/** * Return the nonce (same as IV) associated with this parameter spec. * * @return the nonce/IV. */ public byte[] getNonce() { return getIV(); } }
protected void engineInit(AlgorithmParameterSpec paramSpec) throws InvalidParameterSpecException { if (GcmSpecUtil.isGcmSpec(paramSpec)) { gcmParams = GcmSpecUtil.extractGcmParameters(paramSpec); } else if (paramSpec instanceof AEADParameterSpec) { gcmParams = new GCMParameters(((AEADParameterSpec)paramSpec).getNonce(), ((AEADParameterSpec)paramSpec).getMacSizeInBits() / 8); } else { throw new InvalidParameterSpecException("AlgorithmParameterSpec class not recognized: " + paramSpec.getClass().getName()); } }
param = new AEADParameters(keyParam, aeadSpec.getMacSizeInBits(), aeadSpec.getNonce(), aeadSpec.getAssociatedData());
protected AlgorithmParameterSpec localEngineGetParameterSpec(Class paramSpec) throws InvalidParameterSpecException { if (paramSpec == AlgorithmParameterSpec.class || GcmSpecUtil.isGcmSpec(paramSpec)) { if (GcmSpecUtil.gcmSpecExists()) { return GcmSpecUtil.extractGcmSpec(gcmParams.toASN1Primitive()); } return new AEADParameterSpec(gcmParams.getNonce(), gcmParams.getIcvLen() * 8); } if (paramSpec == AEADParameterSpec.class) { return new AEADParameterSpec(gcmParams.getNonce(), gcmParams.getIcvLen() * 8); } if (paramSpec == IvParameterSpec.class) { return new IvParameterSpec(gcmParams.getNonce()); } throw new InvalidParameterSpecException("AlgorithmParameterSpec not recognized: " + paramSpec.getName()); } }
param = aeadParams = new AEADParameters(keyParam, aeadSpec.getMacSizeInBits(), aeadSpec.getNonce(), aeadSpec.getAssociatedData());
protected AlgorithmParameterSpec localEngineGetParameterSpec(Class paramSpec) throws InvalidParameterSpecException { if (paramSpec == AlgorithmParameterSpec.class || GcmSpecUtil.isGcmSpec(paramSpec)) { if (GcmSpecUtil.gcmSpecExists()) { return GcmSpecUtil.extractGcmSpec(gcmParams.toASN1Primitive()); } return new AEADParameterSpec(gcmParams.getNonce(), gcmParams.getIcvLen() * 8); } if (paramSpec == AEADParameterSpec.class) { return new AEADParameterSpec(gcmParams.getNonce(), gcmParams.getIcvLen() * 8); } if (paramSpec == IvParameterSpec.class) { return new IvParameterSpec(gcmParams.getNonce()); } throw new InvalidParameterSpecException("AlgorithmParameterSpec not recognized: " + paramSpec.getName()); } }
protected void engineInit(AlgorithmParameterSpec paramSpec) throws InvalidParameterSpecException { if (GcmSpecUtil.isGcmSpec(paramSpec)) { gcmParams = GcmSpecUtil.extractGcmParameters(paramSpec); } else if (paramSpec instanceof AEADParameterSpec) { gcmParams = new GCMParameters(((AEADParameterSpec)paramSpec).getNonce(), ((AEADParameterSpec)paramSpec).getMacSizeInBits() / 8); } else { throw new InvalidParameterSpecException("AlgorithmParameterSpec class not recognized: " + paramSpec.getClass().getName()); } }
protected AlgorithmParameterSpec localEngineGetParameterSpec(Class paramSpec) throws InvalidParameterSpecException { if (paramSpec == AlgorithmParameterSpec.class || GcmSpecUtil.isGcmSpec(paramSpec)) { if (GcmSpecUtil.gcmSpecExists()) { return GcmSpecUtil.extractGcmSpec(ccmParams.toASN1Primitive()); } return new AEADParameterSpec(ccmParams.getNonce(), ccmParams.getIcvLen() * 8); } if (paramSpec == AEADParameterSpec.class) { return new AEADParameterSpec(ccmParams.getNonce(), ccmParams.getIcvLen() * 8); } if (paramSpec == IvParameterSpec.class) { return new IvParameterSpec(ccmParams.getNonce()); } throw new InvalidParameterSpecException("AlgorithmParameterSpec not recognized: " + paramSpec.getName()); } }
protected void engineInit(AlgorithmParameterSpec paramSpec) throws InvalidParameterSpecException { if (GcmSpecUtil.isGcmSpec(paramSpec)) { ccmParams = CCMParameters.getInstance(GcmSpecUtil.extractGcmParameters(paramSpec)); } else if (paramSpec instanceof AEADParameterSpec) { ccmParams = new CCMParameters(((AEADParameterSpec)paramSpec).getNonce(), ((AEADParameterSpec)paramSpec).getMacSizeInBits() / 8); } else { throw new InvalidParameterSpecException("AlgorithmParameterSpec class not recognized: " + paramSpec.getClass().getName()); } }
protected AlgorithmParameterSpec localEngineGetParameterSpec(Class paramSpec) throws InvalidParameterSpecException { if (paramSpec == AlgorithmParameterSpec.class || GcmSpecUtil.isGcmSpec(paramSpec)) { if (GcmSpecUtil.gcmSpecExists()) { return GcmSpecUtil.extractGcmSpec(ccmParams.toASN1Primitive()); } return new AEADParameterSpec(ccmParams.getNonce(), ccmParams.getIcvLen() * 8); } if (paramSpec == AEADParameterSpec.class) { return new AEADParameterSpec(ccmParams.getNonce(), ccmParams.getIcvLen() * 8); } if (paramSpec == IvParameterSpec.class) { return new IvParameterSpec(ccmParams.getNonce()); } throw new InvalidParameterSpecException("AlgorithmParameterSpec not recognized: " + paramSpec.getName()); } }
protected void engineInit(AlgorithmParameterSpec paramSpec) throws InvalidParameterSpecException { if (GcmSpecUtil.isGcmSpec(paramSpec)) { ccmParams = CCMParameters.getInstance(GcmSpecUtil.extractGcmParameters(paramSpec)); } else if (paramSpec instanceof AEADParameterSpec) { ccmParams = new CCMParameters(((AEADParameterSpec)paramSpec).getNonce(), ((AEADParameterSpec)paramSpec).getMacSizeInBits() / 8); } else { throw new InvalidParameterSpecException("AlgorithmParameterSpec class not recognized: " + paramSpec.getClass().getName()); } }