Hello,
Perhaps someone can help me with this problem: I'm saving a key pair in a mariadb/mysql table as follows:
str := 'INSERT INTO chaves_de_encriptacao (numero_funcional, chave_privada, chave_publica) '. str := str,'VALUES ('''. str := str, self personId leaId asString, ''', '''. str := str, self keyPair privateKey asAsn1DerBytes asByteArray hex, ''', '''. str := str, self keyPair publicKey asAsn1DerBytes asByteArray hex,''')'.
[ dbConnection execute: str ] on: Exception do: [ ^ false ].
And I'd like to recover the keys (SELECT * FROM chaves_de_encriptacao WHERE numero_funcional = 1010) and then reconvert in order to recover the original keys. Obviously I can do that by writting a parser that will get the hex and bring it back to binary but I'd like to avoid it.
Question is: is there a reverse for asByteArray hex?
2017-09-13 20:59 GMT+02:00 Casimiro de Almeida Barreto < casimiro.barreto@gmail.com>:
Hello,
Perhaps someone can help me with this problem: I'm saving a key pair in a mariadb/mysql table as follows:
str := 'INSERT INTO chaves_de_encriptacao (numero_funcional,
chave_privada, chave_publica) '. str := str,'VALUES ('''. str := str, self personId leaId asString, ''', '''. str := str, self keyPair privateKey asAsn1DerBytes asByteArray hex, ''', '''. str := str, self keyPair publicKey asAsn1DerBytes asByteArray hex,''')'.
[ dbConnection execute: str ] on: Exception do: [ ^ false ].
And I'd like to recover the keys (SELECT * FROM chaves_de_encriptacao WHERE numero_funcional = 1010) and then reconvert in order to recover the original keys. Obviously I can do that by writting a parser that will get the hex and bring it back to binary but I'd like to avoid it.
Question is: is there a reverse for asByteArray hex?
Just browse class side for the most simple snippet:
ByteArray fromHexString: #[0 1 3 65 0] hex
Or are you after something else?
Nicolas Cellier wrote on Wed, 13 Sep 2017 21:19:47 +0200
2017-09-13 20:59 GMT+02:00 Casimiro de Almeida Barreto: Question is: is there a reverse for asByteArray hex?
Just browse class side for the most simple snippet: ByteArray fromHexString: #[0 1 3 65 0] hex Or are you after something else?
I think it would be ByteArray readHexFrom: '08A7C59'
-- Jecel
squeak-dev@lists.squeakfoundation.org