use of sun.security.util.DerOutputStream in project jdk8u_jdk by JetBrains.
the class TSRequest method encode.
public byte[] encode() throws IOException {
DerOutputStream request = new DerOutputStream();
// encode version
request.putInteger(version);
// encode messageImprint
DerOutputStream messageImprint = new DerOutputStream();
hashAlgorithmId.encode(messageImprint);
messageImprint.putOctetString(hashValue);
request.write(DerValue.tag_Sequence, messageImprint);
if (policyId != null) {
request.putOID(new ObjectIdentifier(policyId));
}
if (nonce != null) {
request.putInteger(nonce);
}
if (returnCertificate) {
request.putBoolean(true);
}
DerOutputStream out = new DerOutputStream();
out.write(DerValue.tag_Sequence, request);
return out.toByteArray();
}
use of sun.security.util.DerOutputStream in project jdk8u_jdk by JetBrains.
the class AuthorityInfoAccessExtension 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 (this.extensionValue == null) {
this.extensionId = PKIXExtensions.AuthInfoAccess_Id;
this.critical = false;
encodeThis();
}
super.encode(tmp);
out.write(tmp.toByteArray());
}
use of sun.security.util.DerOutputStream in project jdk8u_jdk by JetBrains.
the class DistributionPointName method encode.
/**
* Encodes the distribution point name and writes it to the DerOutputStream.
*
* @param out the output stream.
* @exception IOException on encoding error.
*/
public void encode(DerOutputStream out) throws IOException {
DerOutputStream theChoice = new DerOutputStream();
if (fullName != null) {
fullName.encode(theChoice);
out.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_FULL_NAME), theChoice);
} else {
relativeName.encode(theChoice);
out.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_RELATIVE_NAME), theChoice);
}
}
use of sun.security.util.DerOutputStream in project jdk8u_jdk by JetBrains.
the class ExtendedKeyUsageExtension method encodeThis.
// Encode this extension value.
private void encodeThis() throws IOException {
if (keyUsages == null || keyUsages.isEmpty()) {
this.extensionValue = null;
return;
}
DerOutputStream os = new DerOutputStream();
DerOutputStream tmp = new DerOutputStream();
for (int i = 0; i < keyUsages.size(); i++) {
tmp.putOID(keyUsages.elementAt(i));
}
os.write(DerValue.tag_Sequence, tmp);
this.extensionValue = os.toByteArray();
}
use of sun.security.util.DerOutputStream in project jdk8u_jdk by JetBrains.
the class ExtendedKeyUsageExtension 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.ExtendedKeyUsage_Id;
critical = false;
encodeThis();
}
super.encode(tmp);
out.write(tmp.toByteArray());
}
Aggregations