use of sun.security.util.DerOutputStream in project jdk8u_jdk by JetBrains.
the class CertificateIssuerExtension method encode.
/**
* Write the extension to the OutputStream.
*
* @param out the OutputStream to write the extension to
* @exception IOException on encoding errors
*/
public void encode(OutputStream out) throws IOException {
DerOutputStream tmp = new DerOutputStream();
if (extensionValue == null) {
extensionId = PKIXExtensions.CertificateIssuer_Id;
critical = true;
encodeThis();
}
super.encode(tmp);
out.write(tmp.toByteArray());
}
use of sun.security.util.DerOutputStream in project jdk8u_jdk by JetBrains.
the class CertificatePoliciesExtension method encode.
/**
* Write the extension to the DerOutputStream.
*
* @param out the DerOutputStream to write the extension to.
* @exception IOException on encoding errors.
*/
public void encode(OutputStream out) throws IOException {
DerOutputStream tmp = new DerOutputStream();
if (extensionValue == null) {
extensionId = PKIXExtensions.CertificatePolicies_Id;
critical = false;
encodeThis();
}
super.encode(tmp);
out.write(tmp.toByteArray());
}
use of sun.security.util.DerOutputStream in project jdk8u_jdk by JetBrains.
the class DistributionPoint method encode.
/**
* Write the DistributionPoint value to the DerOutputStream.
*
* @param out the DerOutputStream to write the extension to.
* @exception IOException on error.
*/
public void encode(DerOutputStream out) throws IOException {
DerOutputStream tagged = new DerOutputStream();
// NOTE: only one of pointNames and pointRDN can be set
if ((fullName != null) || (relativeName != null)) {
DerOutputStream distributionPoint = new DerOutputStream();
if (fullName != null) {
DerOutputStream derOut = new DerOutputStream();
fullName.encode(derOut);
distributionPoint.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_FULL_NAME), derOut);
} else if (relativeName != null) {
DerOutputStream derOut = new DerOutputStream();
relativeName.encode(derOut);
distributionPoint.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_REL_NAME), derOut);
}
tagged.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_DIST_PT), distributionPoint);
}
if (reasonFlags != null) {
DerOutputStream reasons = new DerOutputStream();
BitArray rf = new BitArray(reasonFlags);
reasons.putTruncatedUnalignedBitString(rf);
tagged.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT, false, TAG_REASONS), reasons);
}
if (crlIssuer != null) {
DerOutputStream issuer = new DerOutputStream();
crlIssuer.encode(issuer);
tagged.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_ISSUER), issuer);
}
out.write(DerValue.tag_Sequence, tagged);
}
use of sun.security.util.DerOutputStream in project jdk8u_jdk by JetBrains.
the class CertificatePoliciesExtension method encodeThis.
// Encode this extension value.
private void encodeThis() throws IOException {
if (certPolicies == null || certPolicies.isEmpty()) {
this.extensionValue = null;
} else {
DerOutputStream os = new DerOutputStream();
DerOutputStream tmp = new DerOutputStream();
for (PolicyInformation info : certPolicies) {
info.encode(tmp);
}
os.write(DerValue.tag_Sequence, tmp);
this.extensionValue = os.toByteArray();
}
}
use of sun.security.util.DerOutputStream in project jdk8u_jdk by JetBrains.
the class SubjectInfoAccessExtension method encodeThis.
// Encode this extension value
private void encodeThis() throws IOException {
if (accessDescriptions.isEmpty()) {
this.extensionValue = null;
} else {
DerOutputStream ads = new DerOutputStream();
for (AccessDescription accessDescription : accessDescriptions) {
accessDescription.encode(ads);
}
DerOutputStream seq = new DerOutputStream();
seq.write(DerValue.tag_Sequence, ads);
this.extensionValue = seq.toByteArray();
}
}
Aggregations