File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -165,6 +165,19 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_keypair_create(
165165 const unsigned char * seckey
166166) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 ) SECP256K1_ARG_NONNULL (3 );
167167
168+ /** Get the secret key from a keypair.
169+ *
170+ * Returns: 0 if the arguments are invalid. 1 otherwise.
171+ * Args: ctx: pointer to a context object (cannot be NULL)
172+ * Out: seckey: pointer to a 32-byte buffer for the secret key (cannot be NULL)
173+ * In: keypair: pointer to a keypair (cannot be NULL)
174+ */
175+ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_keypair_sec (
176+ const secp256k1_context * ctx ,
177+ unsigned char * seckey ,
178+ const secp256k1_keypair * keypair
179+ ) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 ) SECP256K1_ARG_NONNULL (3 );
180+
168181/** Get the public key from a keypair.
169182 *
170183 * Returns: 0 if the arguments are invalid. 1 otherwise.
Original file line number Diff line number Diff line change @@ -186,6 +186,16 @@ int secp256k1_keypair_create(const secp256k1_context* ctx, secp256k1_keypair *ke
186186 return ret ;
187187}
188188
189+ int secp256k1_keypair_sec (const secp256k1_context * ctx , unsigned char * seckey , const secp256k1_keypair * keypair ) {
190+ VERIFY_CHECK (ctx != NULL );
191+ ARG_CHECK (seckey != NULL );
192+ memset (seckey , 0 , 32 );
193+ ARG_CHECK (keypair != NULL );
194+
195+ memcpy (seckey , & keypair -> data [0 ], 32 );
196+ return 1 ;
197+ }
198+
189199int secp256k1_keypair_pub (const secp256k1_context * ctx , secp256k1_pubkey * pubkey , const secp256k1_keypair * keypair ) {
190200 VERIFY_CHECK (ctx != NULL );
191201 ARG_CHECK (pubkey != NULL );
You can’t perform that action at this time.
0 commit comments