? new BerInputStream(inStream) : new BerInputStream(encoding); second_asn1_tag = in.next(); // inStream position changed if (encoding == null) {
/** * Decodes ASN.1 SetOf type */ public void readSetOf(ASN1SetOf setOf) throws IOException { if (tag != ASN1Constants.TAG_C_SETOF) { throw expected("setOf"); } decodeValueCollection(setOf); }
public Object decode(BerInputStream in) throws IOException { // FIXME what about constr??? String str = null; if (DirectoryString.ASN1.checkTag(in.tag)) { // has string representation str = (String) DirectoryString.ASN1.decode(in); } else { // gets octets only in.readContent(); } byte[] bytesEncoded = new byte[in.getOffset() - in.getTagOffset()]; System.arraycopy(in.getBuffer(), in.getTagOffset(), bytesEncoded, 0, bytesEncoded.length); return new AttributeValue(str, bytesEncoded, in.tag); }
/** * Decodes ASN.1 Octetstring type */ public void readOctetString() throws IOException { if (tag == ASN1Constants.TAG_OCTETSTRING) { readContent(); } else if (tag == ASN1Constants.TAG_C_OCTETSTRING) { throw new ASN1Exception("Decoding constructed ASN.1 octet string type is not supported"); } else { throw expected("octetstring"); } }
if (tag == ASN1Constants.TAG_GENERALIZEDTIME) { readContent(); times = new int[7]; times[0] = strToInt(contentOffset, 4); // year times[1] = strToInt(contentOffset + 4, 2); // month times[2] = strToInt(contentOffset + 6, 2); // day times[3] = strToInt(contentOffset + 8, 2); // hour times[4] = strToInt(contentOffset + 10, 2); // minute times[5] = strToInt(contentOffset + 12, 2); // second times[6] = strToInt(contentOffset + 15, length - 16); throw new ASN1Exception("Decoding constructed ASN.1 GeneralizedTime type is not supported"); } else { throw expected("GeneralizedTime");
public Object getDecodedObject(BerInputStream in) { Object[] values = (Object[]) in.content; return new CertificationRequest( (CertificationRequestInfo) values[0], (AlgorithmIdentifier) values[1], ((BitString) values[2]).bytes, in.getEncoded()); }
byte[] encoding = new byte[BerInputStream.getLength(buff)]; if (encoding.length < CERT_CACHE_SEED_LENGTH) { throw new CertificateException("Bad Certificate encoding");
/** * Resets this stream to initial state. * * @param encoded a new bytes array to be decoded * @throws IOException if an error occurs */ public final void reset(byte[] encoded) throws IOException { buffer = encoded; next(); }
signatureBlock) throws IOException, GeneralSecurityException { BerInputStream bis = new BerInputStream(signatureBlock); ContentInfo info = (ContentInfo)ContentInfo.ASN1.decode(bis); SignedData signedData = info.getSignedData();
/** * Decodes ASN.1 Set type */ public void readSet(ASN1Set set) throws IOException { if (tag != ASN1Constants.TAG_C_SET) { throw expected("set"); } throw new ASN1Exception("Decoding ASN.1 Set type is not supported"); }
/** * Decodes ASN.1 boolean type */ public void readBoolean() throws IOException { if (tag != ASN1Constants.TAG_BOOLEAN) { throw expected("boolean"); } // check encoded length if (length != 1) { throw new ASN1Exception("Wrong length for ASN.1 boolean at [" + tagOffset + "]"); } readContent(); }
readContent(); times[0] = strToInt(contentOffset, 2); // year if (times[0] > 49) { times[0] += 1900; times[1] = strToInt(contentOffset + 2, 2); // month times[2] = strToInt(contentOffset + 4, 2); // day times[3] = strToInt(contentOffset + 6, 2); // hour times[4] = strToInt(contentOffset + 8, 2); // minute times[5] = strToInt(contentOffset + 10, 2); // second throw new ASN1Exception("Decoding constructed ASN.1 UTCTime type is not supported"); } else { throw expected("UTCTime");
@Override protected Object getDecodedObject(BerInputStream in) { Object[] values = (Object[]) in.content; return new NameConstraints( (GeneralSubtrees) values[0], (GeneralSubtrees) values[1], in.getEncoded()); }
byte[] encoding = new byte[BerInputStream.getLength(buff)]; if (encoding.length < CRL_CACHE_SEED_LENGTH) { throw new CRLException("Bad CRL encoding");
public int next() throws IOException { int tag = super.next(); if (length == INDEFINIT_LENGTH) { throw new ASN1Exception("DER: only definite length encoding MUST be used"); } // FIXME add check: length encoding uses minimum number of octets return tag; }
signatureBlock) throws IOException, GeneralSecurityException { BerInputStream bis = new BerInputStream(signatureBlock); ContentInfo info = (ContentInfo)ContentInfo.ASN1.decode(bis); SignedData signedData = info.getSignedData();
public Object decode(BerInputStream in) throws IOException { // FIXME what about constr??? String str = null; if (DirectoryString.ASN1.checkTag(in.tag)) { // has string representation str = (String) DirectoryString.ASN1.decode(in); } else { // gets octets only in.readContent(); } byte[] bytesEncoded = new byte[in.getOffset() - in.getTagOffset()]; System.arraycopy(in.getBuffer(), in.getTagOffset(), bytesEncoded, 0, bytesEncoded.length); return new AttributeValue(str, bytesEncoded, in.tag); }