use of org.mozilla.jss.netscape.security.util.DerValue in project jss by dogtagpki.
the class CertificateExtensions method decodeEx.
/**
* Decode the extensions from the InputStream.
*
* @param in the InputStream to unmarshal the contents from.
* @exception IOException on decoding or validity errors.
*/
public void decodeEx(InputStream in) throws IOException {
DerValue val = new DerValue(in);
DerInputStream str = null;
if (val.isConstructed() && val.isContextSpecific((byte) 3)) {
str = val.data;
} else {
str = val.toDerInputStream();
}
map = new LinkedHashMap<>();
DerValue[] exts = str.getSequence(5);
for (int i = 0; i < exts.length; i++) {
Extension ext = new Extension(exts[i]);
parseExtension(ext);
}
}
use of org.mozilla.jss.netscape.security.util.DerValue in project jss by dogtagpki.
the class CertificateExtensions method decode.
/**
* Decode the extensions from the InputStream.
*
* @param in the InputStream to unmarshal the contents from.
* @exception IOException on decoding or validity errors.
*/
@Override
public void decode(InputStream in) throws IOException {
DerValue val = new DerValue(in);
DerInputStream str = val.toDerInputStream();
map = new LinkedHashMap<>();
DerValue[] exts = str.getSequence(5);
for (int i = 0; i < exts.length; i++) {
Extension ext = new Extension(exts[i]);
parseExtension(ext);
}
}
use of org.mozilla.jss.netscape.security.util.DerValue in project jss by dogtagpki.
the class CertificateIssuerName method decode.
/**
* Decode the name in DER form from the stream.
*
* @param in the InputStream to marshal the contents from.
* @exception IOException on errors.
*/
@Override
public void decode(InputStream in) throws IOException {
DerValue derVal = new DerValue(in);
dnName = new X500Name(derVal);
}
use of org.mozilla.jss.netscape.security.util.DerValue in project jss by dogtagpki.
the class GenericValueConverter method getValue.
@Override
public DerValue getValue(String valueString, byte[] tags) throws IOException {
if (tags == null || tags.length == 0)
tags = DefEncodingTags;
for (int i = 0; i < tags.length; i++) {
try {
CharsetEncoder encoder = ASN1CharStrConvMap.getDefault().getEncoder(tags[i]);
if (encoder == null)
continue;
CharBuffer charBuffer = CharBuffer.wrap(valueString.toCharArray());
ByteBuffer byteBuffer = encoder.encode(charBuffer);
return new DerValue(tags[i], byteBuffer.array(), byteBuffer.arrayOffset(), byteBuffer.limit());
} catch (CharacterCodingException e) {
continue;
}
}
throw new IOException("Cannot convert the string value to a ASN.1 type");
}
use of org.mozilla.jss.netscape.security.util.DerValue in project jss by dogtagpki.
the class ExtensionsRequested method decode.
@Override
public void decode(InputStream in) throws CertificateException, IOException {
DerValue derVal = new DerValue(in);
construct(derVal);
}
Aggregations