public void init(boolean forSigning, CipherParameters param) { if (forSigning) { if (param instanceof ParametersWithRandom) { ParametersWithRandom rParam = (ParametersWithRandom)param; this.sr = rParam.getRandom(); this.key = (McElieceCCA2PublicKeyParameters)rParam.getParameters(); this.initCipherEncrypt((McElieceCCA2PublicKeyParameters)key); } else { this.sr = new SecureRandom(); this.key = (McElieceCCA2PublicKeyParameters)param; this.initCipherEncrypt((McElieceCCA2PublicKeyParameters)key); } } else { this.key = (McElieceCCA2PrivateKeyParameters)param; this.initCipherDecrypt((McElieceCCA2PrivateKeyParameters)key); } }
public McEliecePointcheval() { super(DigestFactory.createSHA1(), new McEliecePointchevalCipher()); } }
if (opMode == ENCRYPT_MODE) return cipher.messageEncrypt(data); return cipher.messageDecrypt(data);
protected void initCipherDecrypt(Key key, AlgorithmParameterSpec params) throws InvalidKeyException, InvalidAlgorithmParameterException { CipherParameters param; param = McElieceCCA2KeysToParams.generatePrivateKeyParameter((PrivateKey)key); digest.reset(); cipher.init(false, param); }
public int getKeySize(Key key) throws InvalidKeyException { McElieceCCA2KeyParameters mcElieceCCA2KeyParameters; if (key instanceof PublicKey) { mcElieceCCA2KeyParameters = (McElieceCCA2KeyParameters)McElieceCCA2KeysToParams.generatePublicKeyParameter((PublicKey)key); } else { mcElieceCCA2KeyParameters = (McElieceCCA2KeyParameters)McElieceCCA2KeysToParams.generatePrivateKeyParameter((PrivateKey)key); } return cipher.getKeySize(mcElieceCCA2KeyParameters); }
protected void initCipherEncrypt(Key key, AlgorithmParameterSpec params, SecureRandom sr) throws InvalidKeyException, InvalidAlgorithmParameterException { CipherParameters param; param = McElieceCCA2KeysToParams.generatePublicKeyParameter((PublicKey)key); param = new ParametersWithRandom(param, sr); digest.reset(); cipher.init(true, param); }
public void init(boolean forEncryption, CipherParameters param) { this.forEncryption = forEncryption; if (forEncryption) { if (param instanceof ParametersWithRandom) { ParametersWithRandom rParam = (ParametersWithRandom)param; this.sr = rParam.getRandom(); this.key = (McElieceCCA2PublicKeyParameters)rParam.getParameters(); this.initCipherEncrypt((McElieceCCA2PublicKeyParameters)key); } else { this.sr = CryptoServicesRegistrar.getSecureRandom(); this.key = (McElieceCCA2PublicKeyParameters)param; this.initCipherEncrypt((McElieceCCA2PublicKeyParameters)key); } } else { this.key = (McElieceCCA2PrivateKeyParameters)param; this.initCipherDecrypt((McElieceCCA2PrivateKeyParameters)key); } }
public McEliecePointcheval224() { super(DigestFactory.createSHA224(), new McEliecePointchevalCipher()); } }
public McEliecePointcheval256() { super(DigestFactory.createSHA256(), new McEliecePointchevalCipher()); } }
public McEliecePointcheval384() { super(DigestFactory.createSHA384(), new McEliecePointchevalCipher()); } }
public McEliecePointcheval512() { super(DigestFactory.createSHA512(), new McEliecePointchevalCipher()); } }