Method: OpenSSL::Timestamp::TokenInfo#initialize

Defined in:
ossl_ts.c

#initialize(der) ⇒ Object

Creates a TokenInfo from a File or string parameter, the corresponding File or string must be DER-encoded. Please note that TokenInfo is an immutable read-only class. If you’d like to create timestamps please refer to Factory instead.

call-seq:

OpenSSL::Timestamp::TokenInfo.new(file)    -> token-info
OpenSSL::Timestamp::TokenInfo.new(string)  -> token-info


903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
# File 'ossl_ts.c', line 903

static VALUE
ossl_ts_token_info_initialize(VALUE self, VALUE der)
{
    TS_TST_INFO *info = DATA_PTR(self);
    BIO *in;

    der = ossl_to_der_if_possible(der);
    in  = ossl_obj2bio(&der);
    info = d2i_TS_TST_INFO_bio(in, &info);
    BIO_free(in);
    if (!info) {
        DATA_PTR(self) = NULL;
        ossl_raise(eTimestampError, "Error when decoding the timestamp token info");
    }
    DATA_PTR(self) = info;

    return self;
}