private Cipher createCipherForAsymmetricBlockCipherMode(final String transformation, final AsymmetricBlockCipher modeWithEngine, final String engineName, final String modeName, final String paddingName) throws NoSuchPaddingException { AsymmetricBlockCipher padding; if (paddingName.isEmpty() || "NOPADDING".equals(paddingName)) padding = modeWithEngine; else { padding = createAsymmetricBlockCipherPadding(paddingName, modeWithEngine); if (padding == null) throw new NoSuchPaddingException("There is no asymmetric-block-cipher-padding registered with name \"" + paddingName + "\"!"); } return new AsymmetricBlockCipherImpl( transformation, new BufferedAsymmetricBlockCipher(padding) ); }
private void initFromSpec( OAEPParameterSpec pSpec) throws NoSuchPaddingException { MGF1ParameterSpec mgfParams = (MGF1ParameterSpec)pSpec.getMGFParameters(); Digest digest = DigestFactory.getDigest(mgfParams.getDigestAlgorithm()); if (digest == null) { throw new NoSuchPaddingException("no match on OAEP constructor for digest algorithm: "+ mgfParams.getDigestAlgorithm()); } cipher = new BufferedAsymmetricBlockCipher(new OAEPEncoding(new ElGamalEngine(), digest, ((PSource.PSpecified)pSpec.getPSource()).getValue())); paramSpec = pSpec; }
public CipherSpi( AsymmetricBlockCipher engine) { cipher = new BufferedAsymmetricBlockCipher(engine); }
public AsymmetricBlockCipherImpl(final String transformation, final BufferedAsymmetricBlockCipher delegate) { super(transformation); this.delegate = delegate; }