shushlyakov
shushlyakov

Reputation: 21

How to decrypt message gost2001

How to decrypt message:

algorithm="urn:ietf:params:xml:ns:cpxmlsec:algorithms:transport-gost2001

?

File ENC_KEY:

MIGkMCgEIIL21aL9mNsYkPGux4Ywv+0Jh1gn6AYQHgsE9lyPaNi/BARz3b+ooHgGByqFAwICHwGgYzAcBgYqhQMCAhMwEgYHKoUDAgIjAQYHKoUDAgIeAQNDAARA3Xp8QDVUYjezeCDa9zzV3Mo2xK4gxc0vJ8/5yu6Zn5bpTZTTEDty7K9XcWSQRrOQdT7hRSV1osk4EJY9yI9k0gQIaIxb+7AUBFQ=

Decrypt:

    openssl enc -d -A -base64 -in ENC_KEY -out ENC_KEY.DER
    openssl smime -decrypt -engine gost -binary -noattr -inform PEM -in ENC_KEY.DER -out KEY.DER -inkey KEY.PEM
    engine "gost" set.
    Error reading S/MIME message
    139932807476880:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:701:Expecting: PKCS7

Upvotes: 0

Views: 975

Answers (1)

frasertweedale
frasertweedale

Reputation: 5644

You have used the -inform PEM option to tell openssl smime to parse ENC_KEY.DER as a PEM file. ENC_KEY.DER is not in PEM format; it is in DER format. The error message indicates that it is failing to parse a PEM header.

You must change -inform PEM to -inform DER.

Upvotes: 1

Related Questions