protected byte[] engineGetEncoded( String format) throws IOException { if (this.isASN1FormatString(format)) { if (parameterVersion == -1) { return new RC2CBCParameter(engineGetEncoded()).getEncoded(); } else { return new RC2CBCParameter(parameterVersion, engineGetEncoded()).getEncoded(); } } if (format.equals("RAW")) { return engineGetEncoded(); } return null; }
protected void engineInit( byte[] params, String format) throws IOException { if (this.isASN1FormatString(format)) { RC2CBCParameter p = RC2CBCParameter.getInstance(ASN1Primitive.fromByteArray(params)); if (p.getRC2ParameterVersion() != null) { parameterVersion = p.getRC2ParameterVersion().intValue(); } iv = p.getIV(); return; } if (format.equals("RAW")) { engineInit(params); return; } throw new IOException("Unknown parameters format in IV parameters object"); }
public AlgorithmIdentifier getAlgorithmIdentifier(ASN1ObjectIdentifier macOID, AlgorithmParameterSpec paramSpec) { if (paramSpec instanceof IvParameterSpec) { return new AlgorithmIdentifier(macOID, new DEROctetString(((IvParameterSpec)paramSpec).getIV())); } if (paramSpec instanceof RC2ParameterSpec) { RC2ParameterSpec rc2Spec = (RC2ParameterSpec)paramSpec; int effKeyBits = ((RC2ParameterSpec)paramSpec).getEffectiveKeyBits(); if (effKeyBits != -1) { int parameterVersion; if (effKeyBits < 256) { parameterVersion = rc2Table[effKeyBits]; } else { parameterVersion = effKeyBits; } return new AlgorithmIdentifier(macOID, new RC2CBCParameter(parameterVersion, rc2Spec.getIV())); } return new AlgorithmIdentifier(macOID, new RC2CBCParameter(rc2Spec.getIV())); } throw new IllegalStateException("unknown parameter spec: " + paramSpec); }
protected void engineInit( byte[] params, String format) throws IOException { if (this.isASN1FormatString(format)) { ASN1InputStream aIn = new ASN1InputStream(params); RC2CBCParameter p = RC2CBCParameter.getInstance(aIn.readObject()); if (p.getRC2ParameterVersion() != null) { parameterVersion = p.getRC2ParameterVersion().intValue(); } iv = p.getIV(); return; } if (format.equals("RAW")) { engineInit(params); return; } throw new IOException("Unknown parameters format in IV parameters object"); }