/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "secutil.h" #include "nss.h" #include "certt.h" #include "keyhi.h" #include "pk11pub.h" #include unsigned char bytes[] = { 0x24, 0x0a, 0x24, 0x80, 0x04, 0x01, 0x01, 0x00, 0x00, 0x04, 0x01, 0x02, }; const SEC_ASN1Template OCTET_STRING_Template[] = { { SEC_ASN1_OCTET_STRING, 0 }, { 0 } }; int main(int argc, char** argv) { PLArenaPool* temparena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); if (!temparena) { return 1; } SECItem output; memset(&output, 0, sizeof(SECItem)); SECItem data = { siBuffer, bytes, sizeof(bytes) }; SECStatus rv = SEC_ASN1DecodeItem(temparena, &output, OCTET_STRING_Template, &data); PORT_FreeArena(temparena, PR_FALSE); if (rv != SECSuccess) { return 1; } return 0; }