/** * Just re-encode the outer layer of the PKCS#12 file to definite length encoding. * * @param berPKCS12File - original PKCS#12 file * @return a byte array representing the DER encoding of the PFX structure * @throws IOException */ public static byte[] convertToDefiniteLength(byte[] berPKCS12File) throws IOException { ByteArrayOutputStream bOut = new ByteArrayOutputStream(); DEROutputStream dOut = new DEROutputStream(bOut); Pfx pfx = Pfx.getInstance(berPKCS12File); bOut.reset(); dOut.writeObject(pfx); return bOut.toByteArray(); }
/** * Just re-encode the outer layer of the PKCS#12 file to definite length encoding. * * @param berPKCS12File - original PKCS#12 file * @return a byte array representing the DER encoding of the PFX structure * @throws IOException */ public static byte[] convertToDefiniteLength(byte[] berPKCS12File) throws IOException { ByteArrayOutputStream bOut = new ByteArrayOutputStream(); DEROutputStream dOut = new DEROutputStream(bOut); Pfx pfx = Pfx.getInstance(berPKCS12File); bOut.reset(); dOut.writeObject(pfx); return bOut.toByteArray(); }
private static Pfx parseBytes(byte[] pfxEncoding) throws IOException { try { return Pfx.getInstance(ASN1Primitive.fromByteArray(pfxEncoding)); } catch (ClassCastException e) { throw new CertIOException("malformed data: " + e.getMessage(), e); } catch (IllegalArgumentException e) { throw new CertIOException("malformed data: " + e.getMessage(), e); } }
private static Pfx parseBytes(byte[] pfxEncoding) throws IOException { try { return Pfx.getInstance(ASN1Primitive.fromByteArray(pfxEncoding)); } catch (ClassCastException e) { throw new PKCSIOException("malformed data: " + e.getMessage(), e); } catch (IllegalArgumentException e) { throw new PKCSIOException("malformed data: " + e.getMessage(), e); } }
throws IOException Pfx pfx = Pfx.getInstance(berPKCS12File);
throws IOException Pfx pfx = Pfx.getInstance(berPKCS12File);
Pfx bag = Pfx.getInstance(obj); ContentInfo info = bag.getAuthSafe(); Vector chain = new Vector();
Pfx bag = Pfx.getInstance(obj); ContentInfo info = bag.getAuthSafe(); Vector chain = new Vector();