コード例 #1
0
  @Override
  public PasswordBasedCipher getInstance(boolean forEncryption, byte[] password, byte[] encoded) {
    ASN1Sequence seq = ASN1Sequence.getInstance(encoded);
    AlgorithmIdentifier alg = getPBES2AlgorithmIdentifier(seq);

    PBES2Parameters params = PBES2Parameters.getInstance(alg.getParameters());
    PasswordBasedCipherFactory pbecf = getPBES2CipherFactory(params.getEncryptionScheme());
    PasswordBasedCipher cipher = getBcPBES2PasswordBasedCipher(pbecf, forEncryption, password, seq);

    if (cipher != null) {
      return cipher;
    }
    return pbecf.getInstance(forEncryption, password, encoded);
  }
コード例 #2
0
 @Override
 public PasswordBasedCipher getInstance(
     boolean forEncryption, byte[] password, ASN1Encodable parameters) {
   return getBcPBES2PasswordBasedCipher(
       getPBES2CipherFactory(
           PBES2Parameters.getInstance(getPBES2AlgorithmIdentifier(parameters).getParameters())
               .getEncryptionScheme()),
       forEncryption,
       password,
       parameters);
 }