98 } catch (IOException e) {
99 throw new IllegalArgumentException("Incorrect format: value", e);
100 }
101 }
102
103 /**
104 * Constructs a PKCS12 attribute from its ASN.1 DER encoding.
105 * The DER encoding is specified by the following ASN.1 definition:
106 * <pre>
107 *
108 * Attribute ::= SEQUENCE {
109 * type AttributeType,
110 * values SET OF AttributeValue
111 * }
112 * AttributeType ::= OBJECT IDENTIFIER
113 * AttributeValue ::= ANY defined by type
114 *
115 * </pre>
116 *
117 * @param encoded the attribute's ASN.1 DER encoding. It is cloned
118 * to prevent subsequent modificaion.
119 *
120 * @throws NullPointerException if {@code encoded} is
121 * {@code null}
122 * @throws IllegalArgumentException if {@code encoded} is
123 * incorrectly formatted
124 */
125 public PKCS12Attribute(byte[] encoded) {
126 if (encoded == null) {
127 throw new NullPointerException();
128 }
129 this.encoded = encoded.clone();
130
131 try {
132 parse(encoded);
133 } catch (IOException e) {
134 throw new IllegalArgumentException("Incorrect format: encoded", e);
135 }
136 }
137
138 /**
|
98 } catch (IOException e) {
99 throw new IllegalArgumentException("Incorrect format: value", e);
100 }
101 }
102
103 /**
104 * Constructs a PKCS12 attribute from its ASN.1 DER encoding.
105 * The DER encoding is specified by the following ASN.1 definition:
106 * <pre>
107 *
108 * Attribute ::= SEQUENCE {
109 * type AttributeType,
110 * values SET OF AttributeValue
111 * }
112 * AttributeType ::= OBJECT IDENTIFIER
113 * AttributeValue ::= ANY defined by type
114 *
115 * </pre>
116 *
117 * @param encoded the attribute's ASN.1 DER encoding. It is cloned
118 * to prevent subsequent modification.
119 *
120 * @throws NullPointerException if {@code encoded} is
121 * {@code null}
122 * @throws IllegalArgumentException if {@code encoded} is
123 * incorrectly formatted
124 */
125 public PKCS12Attribute(byte[] encoded) {
126 if (encoded == null) {
127 throw new NullPointerException();
128 }
129 this.encoded = encoded.clone();
130
131 try {
132 parse(encoded);
133 } catch (IOException e) {
134 throw new IllegalArgumentException("Incorrect format: encoded", e);
135 }
136 }
137
138 /**
|