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


864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
# File 'ossl_ts.c', line 864

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)
        ossl_raise(eTimestampError, "Error when decoding the timestamp token info");
    DATA_PTR(self) = info;

    return self;
}