---
name: "ASN1_STRING_new"
section: "3ssl"
platform: "linux"
package: "openssl"
version: "3.6.5-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/ASN1_STRING_new"
---

# ASN1\_STRING\_new(3ssl)

ASN1\_STRING allocation functions

## NAME

ASN1\_STRING\_new, ASN1\_STRING\_type\_new, ASN1\_STRING\_free - ASN1\_STRING allocation functions

## SYNOPSIS

```
 #include <openssl/asn1.h>
 ASN1_STRING *ASN1_STRING_new(void);
 ASN1_STRING *ASN1_STRING_type_new(int type);
 void ASN1_STRING_free(ASN1_STRING *a);
```

## DESCRIPTION

**ASN1\_STRING\_new()** returns an allocated **ASN1\_STRING** structure. Its type is undefined.

**ASN1\_STRING\_type\_new()** returns an allocated **ASN1\_STRING** structure of type *type*.

**ASN1\_STRING\_free()** frees up *a*. If *a* is NULL nothing is done.

## NOTES

Other string types call the **ASN1\_STRING** functions. For example **ASN1\_OCTET\_STRING\_new()** calls ASN1\_STRING\_type\_new(V\_ASN1\_OCTET\_STRING).

## RETURN VALUES

**ASN1\_STRING\_new()** and **ASN1\_STRING\_type\_new()** return a valid **ASN1\_STRING** structure or NULL if an error occurred.

**ASN1\_STRING\_free()** does not return a value.

## SEE ALSO

**ERR\_get\_error**(3)

## COPYRIGHT

Copyright 2002-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License").  You may not use this file except in compliance with the License.  You can obtain a copy in the file LICENSE in the source distribution or at \<https://www.openssl.org/source/license.html\>.
