Here you can find the source of readDERString(ByteBuffer buf)
Parameter | Description |
---|---|
buf | buffer containing DER encoded bytes. |
public static byte[] readDERString(ByteBuffer buf)
//package com.java2s; //License from project: Open Source License import java.nio.ByteBuffer; public class Main { /**/*from www .ja v a 2 s .c o m*/ * This method reads a DER encoded byte string from a ByteBuffer. * * A DER encoded string has * * length = 4 bytes big-endian integer<br/> * string = length bytes * * @param buf * buffer containing DER encoded bytes. * @return bytes the decoded bytes. */ public static byte[] readDERString(ByteBuffer buf) { int length = buf.getInt(); if (length > 8192) { throw new IllegalArgumentException("DER String Length " + length + " > 8192"); } byte[] bytes = new byte[length]; buf.get(bytes); return bytes; } }