summaryrefslogtreecommitdiffstats
path: root/base/util/test/com/netscape/security/x509/ConverterTestUtil.java
blob: 748c1b284bc30321710a936a6de8be645fca91cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package com.netscape.security.x509;

import netscape.security.util.DerOutputStream;
import netscape.security.util.DerValue;
import netscape.security.x509.AVAValueConverter;

public class ConverterTestUtil {

    public static byte[] convert(AVAValueConverter converter, String string, byte[] tags) throws Exception {

        DerOutputStream os = new DerOutputStream();

        DerValue value = converter.getValue(string, tags);
        value.encode(os);

        return os.toByteArray();
    }

    public static byte[] convert(AVAValueConverter converter, String string) throws Exception {
        return convert(converter, string, null);
    }
}