Re: [openssl-users] Sign and verification using ECC 25519 curve- Bernstein
Hi, I am using Qnx 7.0.0 which make use of openssl 1.0.2j. Can you please confirm if I can use ECC related api from openssl which is supported by openssl 1.1.0. On Mon, 1 Oct 2018, 3:41 pm Matt Caswell, wrote: > > > On 01/10/18 10:11, Linta Maria wrote: > > Hi all, > > > > Does openssl supports sign and verification using ECC 25519 curve > > Bernstein? > > > > > > Yes. See: > > https://www.openssl.org/docs/man1.1.1/man7/Ed25519.html > > Matt > -- > openssl-users mailing list > To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users > -- openssl-users mailing list To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
[openssl-users] Sign and verification using ECC 25519 curve- Bernstein
Hi all, Does openssl supports sign and verification using ECC 25519 curve Bernstein? -- openssl-users mailing list To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
[openssl-users] Default salt and padding for signature
Hi, Can you please let me know default salt and padding used for signature generation in open ssl as we are not able to get the info . Regards, Linta -- openssl-users mailing list To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
[openssl-users] Fwd: Openssl api for signature verification using digest
Hi Viktor, As you suggested, signature wasn't correct. With below input also it's not working. Pubkey is read to evp_PKEY format EVP_PKEY * vkey; char PubKey [] ="-BEGIN PUBLIC KEY-""\n" "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxEZo8DRHBFBN0w1YYw3w" "\n" "C/C/IxCH3WSDCBTZgPux+/Cm+Q+LtSHjxV2x+hHuR8+cWMgFIrpvN0jw1F6g0f3A" "\n" "QQvQmPkyIUZGN1C9Da+SEdpc12gZdAOdILUaeiDRNUYXJinbBPQaNGAQIWwuzCuj" "\n" "5sjZPrlJYDQ52kq2U86ZNcS/NVRZi+pFB4u0YHHiqJkQYT6yCQjR9Rdvxvjyg9L5" "\n" "9petX/xa0tBurw5eTLOC9UlufblJnS7zrVkpoHdtt9rRgDBJ4kTJypeHq0Tybgro" "\n" "hhxG1EqdAjoD0OjLV93JWr0DOmwWVE1SoJH/UBbgRXf40hxhdzswgJFWJLIdxfdj" "\n" "BwIDAQAB" "\n" "-END PUBLIC KEY-"; BIO *bio; bio = BIO_new_mem_buf(PubKey, strlen(PubKey) ); PEM_read_bio_PUBKEY( bio, , NULL, NULL ); unsigned char signew[]={0x14, 0x7e, 0x86, 0x9f, 0xfb, 0x10, 0xc8, 0xa4, 0x98, 0xae, 0xcb, 0xf8, 0xd4, 0xd7, 0xad, 0xf2, 0x18, 0x40, 0xaf, 0x06, 0x85, 0x8a, 0x69, 0xde, 0x29, 0x50, 0xf2, 0x52, 0x1c, 0x01, 0xbc, 0x3c, 0x45, 0x42, 0xb1, 0x32, 0xd8, 0x19, 0xf6, 0xf3, 0x11, 0x39, 0x03, 0xbf, 0x23, 0xfb, 0x5d, 0x97, 0x41, 0xb9, 0x85, 0xaf, 0x31, 0xf8, 0x32, 0x2f, 0xd2, 0xb6, 0x5b, 0xf1, 0x22, 0xfd, 0xda, 0x28, 0x58, 0x6f, 0x45, 0x4b, 0x5c, 0x74, 0xf0, 0x84, 0xf2, 0x1e, 0xfa, 0x33, 0xa3, 0x83, 0x38, 0x9f, 0xcf, 0x71, 0x37, 0x77, 0x6d, 0x86, 0x84, 0xc6, 0x5e, 0x3b, 0x71, 0xf5, 0x29, 0x2a, 0x43, 0xf4, 0x43, 0x38, 0x0a, 0x18, 0xf5, 0xbe, 0x6f, 0x03, 0xd3, 0x16, 0x79, 0x13, 0x89, 0x95, 0xb2, 0xd7, 0x27, 0xcf, 0xd4, 0x2b, 0x6b, 0xa1, 0xbd, 0xe3, 0x8e, 0xac, 0x24, 0x1b, 0xdd, 0x17, 0xf8, 0xe1, 0xf5, 0xb9, 0x5a, 0xd4, 0x97, 0xf4, 0xc3, 0xfc, 0x69, 0xc8, 0x40, 0x30, 0x76, 0x7d, 0x18, 0x7c, 0x58, 0x11, 0x3d, 0x78, 0x27, 0x41, 0xab, 0x1c, 0xd2, 0xd3, 0x5f, 0xe2, 0x94, 0xe1, 0x49, 0xba, 0x6b, 0xd7, 0xbe, 0x3a, 0x9d, 0x86, 0x62, 0xdc, 0xd7, 0x46, 0xae, 0xa3, 0x8e, 0xe1, 0x46, 0x27, 0xbc, 0xb2, 0x31, 0x69, 0xc5, 0x54, 0x15, 0x85,0x74, 0x1a, 0x66, 0x94, 0xa6, 0x68, 0x5e, 0xa2,0x1c, 0x38, 0x3d, 0x84, 0xd8, 0x3f, 0x84, 0x81,0x56, 0xc2, 0x9c, 0xac, 0xef, 0x68, 0xef, 0x68,0x96, 0xb3, 0xd1, 0xa9, 0x3a, 0x43, 0x75, 0xef,0xaf, 0xf2, 0x1b, 0xea, 0x96, 0xb8, 0x23, 0xef,0xa6, 0x09, 0x89, 0x15, 0x52, 0x26, 0xce, 0x1f,0x98, 0x02, 0x83, 0x22, 0x08, 0x60, 0x6c, 0xd9,0x14, 0x64, 0xe8, 0xef, 0x53, 0xea, 0x48, 0x60,0xbb, 0x69, 0x49, 0x64, 0xa3, 0x0d, 0xdb, 0xaa}; unsigned char hashnew[]={0x8f,0x43,0x43,0x46,0x64,0x8f,0x6b,0x96,0xdf,0x89,0xdd,0xa9,0x1c,0x51,0x76,0xb1,0x0a,0x6d,0x83,0x96,0x1d,0xd3,0xc1,0xac,0x88,0xb5,0x9b,0x2d,0xc3,0x27,0xaa,0x4}; -- Forwarded message - From: *Viktor Dukhovni* Date: Wed 29 Aug, 2018, 11:30 AM Subject: Re: [openssl-users] Openssl api for signature verification using digest To: openssl-users@openssl.org > On Aug 29, 2018, at 1:05 AM, Linta Maria wrote: > > Still its not working. The code is working correctly. The real problem is that the PEM format 2048-bit RSA key you posted: > BEGIN PUBLIC KEY- > MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzMjyWZfVfBpmNKmIm9HH > FnrhDLZaCmQvZz57uJHhBLwLk/UAJ+kLKV9Lox8eKfimzisPFBad/TUfwPUaQmji > bPKCp+or2EHvPFooOnPWjSd57zPCohDdo0nOLw7iTUOMCvoqvJcdor+t1zBb8MQK > yNTycuoGlT19lr8msJFtR+ulfKucj/zk5w/jr0SsxysqFsvtEfa62Wu/wSDYIfsq > lKlRGLTlqJNtQybtTVv2Uu2KFrbe0C8+FBkxgtBS+0MkhzpJ37/02J+mHFx1bsgN > 09QnQY+T05te+6/mmlsHP3PYRqXqJOLl9AkLd/9kiMhSFshowFehKmls9PYt1xGf > 5QIDAQAB > -END PUBLIC KEY- is NOT the key that was used to generate the below signature, or the signature was subsequently altered. > Signature={ 0x24,0xb8,0xec,0xb4,0x4f,0x31,0xa6,0x8,0x72,0x61,0xc9,0xd3,0x1c,0xd0,0x9b,0xee,0x26,0x2d,0x3d,0xef,0xff,0x2c,0x5,0x78,0x4,0xd3,0xa3,0xff,0xdc,0x97,0x53,0xe6,0x6e,0x85,0x41,0x1b,0xb2,0x2c,0xed,0xbd,0xa6,0x5d,0x6f,0xac,0xbb,0xd5,0xb8,0xa0,0x9,0x2b,0xf1,0xf5,0xb6,0xce,0xdd,0x70,0x8a,0x1a,0xa1,0x20,0x11,0x2b,0xf0,0x17,0x41,0x83,0x80,0xf6,0x61,0xd4,0x6d,0x53,0x8f,0xf1,0x8c,0x19,0x42,0x93,0x96,0xa9,0xb6,0xf2,0x8f,0x27,0x9c,0x66,0x17,0xc5,0xca,0x3d,0xa9,0x3f,0xc5,0x76,0x5f,0x1b,0x31,0xf2,0xd3,0xe,0x78,0x53,0x97,0xcb,0x9d,0xc4,0xe6,0x41,0x61,0x58,0x44,0x5c,0xf5,0xc4,0x67,0x69,0x8,0xa,0x92,0xd5,0x7e,0x9c,0xb9,0x7e,0x54,0x8b,0x8a,0xb,0xa1,0x9a,0x63,0xbf,0xcc,0xed,0x63,0x2c,0xf8,0x14,0x25,0x6,0xa2,0x2,0x0,0x7,0x2e,0x1c,0xc1,0xeb,0x16,0x89,0xaa,0x69,0xe2,0x75,0x57,0x39,0x71,0x68,0xe,0xf,0xa4,0x7a,0xc5,0x14,0x97,0x88,0x67,0xd1,0x36,0x91,0x3b,0x49,0xe7,0xb4,0xf3,0xcb,0xca,0xf6,0xe9,0xb1,0x22,0xe9,0x85,0x89,0xab,0x2,0x4,0x3c,0x2e,0xbd,0x56,0x3,0x8a,0x8b,0x54,0xc6,0xe6,0xed,0x5b,0x4c,0 xa4,0x9e,0x1b,0xaa,0x90,0xc6,0xb,0x27,0x54,0xc0,0x50,0x5f,0x58,0x97,0xc,0x99,0x5c,0x2,0x74,0xfc,0x9f,0x4c,0x78,0x4e,0xc3,0xb4,0x6d,0x14,0xa1,0xdc,0x62,0xc5,0xfe,0x27,0xb8,0x7d,0x98,0x79,0x82,0x50,0x3a,0xbe,0x6f,
[openssl-users] Openssl api for signature verification using digest
Thanks Viktor for the help…. Please find below the input format. Still its not working. > On Aug 28, 2018, at 7:08 AM, Linta Maria wrote: > > I have used below code, but it’s not working. Please help me to get the correct API. > > /* > * NB: assumes verify_key, sig, siglen md and mdlen are already set up > * and that verify_key is an RSA public key > */ In what form is the message digest? Is it the raw digest octets, or some hex or base64 encoding? In what form is the signature? Message digest and signature is given in hex format. Msg ={ 0x8f,0x43,0x43,0x46,0x64,0x8f,0x6b,0x96,0xdf,0x89,0xdd,0xa9,0x1c,0x51,0x76,0xb1,0x0a,0x6d,0x83,0x96,0x1d,0xd3,0xc1,0xac,0x88,0xb5,0x9b,0x2d,0xc3,0x27,0xaa,0x4}; Signature={ 0x24,0xb8,0xec,0xb4,0x4f,0x31,0xa6,0x8,0x72,0x61,0xc9,0xd3,0x1c,0xd0,0x9b,0xee,0x26,0x2d,0x3d,0xef,0xff,0x2c,0x5,0x78,0x4,0xd3,0xa3,0xff,0xdc,0x97,0x53,0xe6,0x6e,0x85,0x41,0x1b,0xb2,0x2c,0xed,0xbd,0xa6,0x5d,0x6f,0xac,0xbb,0xd5,0xb8,0xa0,0x9,0x2b,0xf1,0xf5,0xb6,0xce,0xdd,0x70,0x8a,0x1a,0xa1,0x20,0x11,0x2b,0xf0,0x17,0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+or2EHvPFooOnPWjSd57zPCohDdo0nOLw7iTUOMCvoqvJcdor+t1zBb8MQK yNTycuoGlT19lr8msJFtR+ulfKucj/zk5w/jr0SsxysqFsvtEfa62Wu/wSDYIfsq lKlRGLTlqJNtQybtTVv2Uu2KFrbe0C8+FBkxgtBS+0MkhzpJ37/02J+mHFx1bsgN 09QnQY+T05te+6/mmlsHP3PYRqXqJOLl9AkLd/9kiMhSFshowFehKmls9PYt1xGf 5QIDAQAB -END PUBLIC KEY- > ctx = EVP_PKEY_CTX_new(verify_key, NULL /* no engine */); > if (!ctx) > /* Error occurred */ > > if (EVP_PKEY_verify_init(ctx) <= 0) > /* Error */ > > if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING) <= 0) > /* Error */ > > if (EVP_PKEY_CTX_set_signature_md(ctx, EVP_sha256()) <= 0) > /* Error */ Since you're verifying a hash, do not configure a message digest. > /* Perform operation */ > > ret = EVP_PKEY_verify(ctx, sig, siglen, md, mdlen); This is the right function for verifying public key signatures over some input. For more help, post the *public* key used, the signature and the input digest. Message digest and signature is given in hex format. Msg ={ 0x8f,0x43,0x43,0x46,0x64,0x8f,0x6b,0x96,0xdf,0x89,0xdd,0xa9,0x1c,0x51,0x76,0xb1,0x0a,0x6d,0x83,0x96,0x1d,0xd3,0xc1,0xac,0x88,0xb5,0x9b,0x2d,0xc3,0x27,0xaa,0x4}; Signature={ 0x24,0xb8,0xec,0xb4,0x4f,0x31,0xa6,0x8,0x72,0x61,0xc9,0xd3,0x1c,0xd0,0x9b,0xee,0x26,0x2d,0x3d,0xef,0xff,0x2c,0x5,0x78,0x4,0xd3,0xa3,0xff,0xdc,0x97,0x53,0xe6,0x6e,0x85,0x41,0x1b,0xb2,0x2c,0xed,0xbd,0xa6,0x5d,0x6f,0xac,0xbb,0xd5,0xb8,0xa0,0x9,0x2b,0xf1,0xf5,0xb6,0xce,0xdd,0x70,0x8a,0x1a,0xa1,0x20,0x11,0x2b,0xf0,0x17,0x41,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EHvPFooOnPWjSd57zPCohDdo0nOLw7iTUOMCvoqvJcdor+t1zBb8MQK yNTycuoGlT19lr8msJFtR+ulfKuc
Re: [openssl-users] Openssl api for signature verification using digest
Thanks Nicola for the updates. But I need to verify signature with hashed data or digest not with original message. Is there any openssl API to implement that? On Tue 28 Aug, 2018, 5:18 PM Nicola, wrote: > Hi! > > I would suggest using the newer `EVP_DigestSign` interface. > > You could find more documentation about it here: > https://wiki.openssl.org/index.php/EVP_Signing_and_Verifying > > Here is the relevant manpage: > https://www.openssl.org/docs/man1.1.1/man3/EVP_DigestVerifyInit.html > > Best regards, > > Nicola Tuveri > > On Tue, Aug 28, 2018, 14:09 Linta Maria wrote: > >> >> >> Hi All, >> >> >> >> >> >> I have started using open ssl recently for implementing some >> cryptographic operation. >> >> Now I want to implement signature verification by taking Signature and >> hashed data as input, but I am not able to get the proper API. >> >> I have used below code, but it’s not working. Please help me to get the >> correct API. >> >> >> >> >> >> #include >> >> #include >> >> >> >> EVP_PKEY_CTX *ctx; >> >> unsigned char *md, *sig; >> >> size_t mdlen, siglen; >> >> EVP_PKEY *verify_key; >> >> >> >> /* >> >> * NB: assumes verify_key, sig, siglen md and mdlen are already set up >> >> * and that verify_key is an RSA public key >> >> */ >> >> ctx = EVP_PKEY_CTX_new(verify_key, NULL /* no engine */); >> >> if (!ctx) >> >> /* Error occurred */ >> >> if (EVP_PKEY_verify_init(ctx) <= 0) >> >> /* Error */ >> >> if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING) <= 0) >> >> /* Error */ >> >> if (EVP_PKEY_CTX_set_signature_md(ctx, EVP_sha256()) <= 0) >> >> /* Error */ >> >> >> >> /* Perform operation */ >> >> ret = EVP_PKEY_verify(ctx, sig, siglen, md, mdlen); >> >> >> >> /* >> >> * ret == 1 indicates success, 0 verify failure and < 0 for some >> >> * other error. >> >> */ >> >> >> >> >> >> >> >> Best regards, >> >> *George Linta Maria* >> -- >> openssl-users mailing list >> To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users >> > -- > openssl-users mailing list > To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users > -- openssl-users mailing list To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
[openssl-users] Openssl api for signature verification using digest
Hi All, I have started using open ssl recently for implementing some cryptographic operation. Now I want to implement signature verification by taking Signature and hashed data as input, but I am not able to get the proper API. I have used below code, but it’s not working. Please help me to get the correct API. #include #include EVP_PKEY_CTX *ctx; unsigned char *md, *sig; size_t mdlen, siglen; EVP_PKEY *verify_key; /* * NB: assumes verify_key, sig, siglen md and mdlen are already set up * and that verify_key is an RSA public key */ ctx = EVP_PKEY_CTX_new(verify_key, NULL /* no engine */); if (!ctx) /* Error occurred */ if (EVP_PKEY_verify_init(ctx) <= 0) /* Error */ if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING) <= 0) /* Error */ if (EVP_PKEY_CTX_set_signature_md(ctx, EVP_sha256()) <= 0) /* Error */ /* Perform operation */ ret = EVP_PKEY_verify(ctx, sig, siglen, md, mdlen); /* * ret == 1 indicates success, 0 verify failure and < 0 for some * other error. */ Best regards, *George Linta Maria* -- openssl-users mailing list To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users