package org.bouncycastle.jcajce; import org.bouncycastle.crypto.PBEParametersGenerator; /* loaded from: classes6.dex */ public class PKCS12Key implements PBKDFKey { private final char[] password; private final boolean useWrongZeroLengthConversion; public char[] getPassword() { return this.password; } @Override // java.security.Key public String getFormat() { return "PKCS12"; } @Override // java.security.Key public byte[] getEncoded() { return (this.useWrongZeroLengthConversion && this.password.length == 0) ? new byte[2] : PBEParametersGenerator.PKCS12PasswordToBytes(this.password); } @Override // java.security.Key public String getAlgorithm() { return "PKCS12"; } public PKCS12Key(char[] cArr, boolean z) { char[] cArr2 = new char[cArr.length]; this.password = cArr2; this.useWrongZeroLengthConversion = z; System.arraycopy(cArr, 0, cArr2, 0, cArr.length); } public PKCS12Key(char[] cArr) { this(cArr, false); } }