/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* A ContentInfo type, as defined in PKCS#7.
*
* @author Benjamin Renaud
*/
public class ContentInfo {
// pkcs7 pre-defined content types
// timestamp token (id-ct-TSTInfo) from RFC 3161
// this is for backwards-compatibility with JDK 1.1.x
static {
/**
* The ASN.1 systax for the Netscape Certificate Sequence
* data type is defined
* here.</a>
*/
}
this.contentType = contentType;
}
/**
* Make a contentInfo of type data.
*/
this.contentType = DATA_OID;
this.content = octetString;
}
/**
* Parses a PKCS#7 content info.
*/
throws IOException, ParsingException
{
this(derin, false);
}
/**
* Parses a PKCS#7 content info.
*
* <p>This constructor is used only for backwards compatibility with
* PKCS#7 blocks that were generated using JDK1.1.x.
*
* @param derin the ASN.1 encoding of the content info.
* @param oldStyle flag indicating whether or not the given content info
* is encoded according to JDK1.1.x.
*/
throws IOException, ParsingException
{
// Parse the content type
if (oldStyle) {
// JDK1.1.x-style encoding
} else {
// This is the correct, standards-compliant encoding.
// Parse the content (OPTIONAL field).
// Skip the [0] EXPLICIT tag by pretending that the content is the
// one and only element in an implicitly tagged set
}
}
}
return content;
}
return contentType;
}
return null;
else
return content.getOctetString();
}
}
seq = new DerOutputStream();
// content is optional, it could be external
contentDerCode = new DerOutputStream();
// Add the [0] EXPLICIT tag in front of the content encoding
}
}
/**
* Returns a byte array representation of the data held in
* the content field.
*/
return null;
return dis.getOctetString();
}
return out;
}
}