Removing entries from GPG Keyservers - public-key-encryption

I've been using GPG for a few years and my entry at the various directories, such as the Ubuntu's keyserver, is now pretty messy:
uid Andy McCall (Andy McCall's PGP Key) <andy.mccall#xxx.xxx>
sig sig 0463e8da7a2779b7 2021-12-19T12:26:56Z 2026-12-18T11:39:55Z ____________________ [selfsig]
sig sig 0463e8da7a2779b7 2018-06-05T13:47:23Z 2020-03-21T21:31:35Z ____________________ [selfsig]
sig sig 0463e8da7a2779b7 2017-07-20T19:12:35Z 2020-03-21T21:31:35Z ____________________ [selfsig]
sig sig 9710b89bca57ad7c 2019-05-29T12:00:24Z 2019-06-12T12:00:24Z ____________________ 9710b89bca57ad7c
sig sig 9710b89bca57ad7c 2019-06-11T12:00:55Z 2019-06-25T12:00:55Z ____________________ 9710b89bca57ad7c
sig sig 9710b89bca57ad7c 2019-06-25T00:00:51Z 2019-07-09T00:00:51Z ____________________ 9710b89bca57ad7c
sig sig 9710b89bca57ad7c 2019-07-08T12:00:55Z 2019-07-22T12:00:55Z ____________________ 9710b89bca57ad7c
sig sig 9710b89bca57ad7c 2019-09-14T00:00:37Z 2019-09-28T00:00:37Z ____________________ 9710b89bca57ad7c
Is it possible to remove some of the earlier entries? For example, I really only need the following entry:
uid Andy McCall (Andy McCall's PGP Key) <andy.mccall#xxx.xxx>
sig sig 0463e8da7a2779b7 2021-12-19T12:26:56Z 2026-12-18T11:39:55Z ____________________ [selfsig]
I've have access to my private key, but the specific gpg keychain that some of the earlier entries were made on has been lost.

It's common thing to keep history of all the key self-signatures, since they prove what was happening with a key in a certain point in time - i.e. it was valid for a year in 2019, then re-certified in 2020 to extend lifespan and so on. For instance if you generated a signature with that key in 2019, with the single 2021-2026 entry it would not be possible to tell that signature was valid in 2019.

Related

How to change comments in excel file with go

I'm using the excelize library.
newfile, _ := excelize.OpenFile("filename.xlsx")
println(newfile.GetComments())
//map[Sheet1:[{Author 0 A2 comment1}]]
_ = newfile.InsertRow("Sheet1", 1)
println(newfile.GetComments())
//map[Sheet1:[{Author 0 A2 comment1}]]
the coordinates of my comment comment1 have not changed. How to solve this problem?

How do I sign a curve25519 key in golang?

I am trying to implement the X3DH algorithm from Signal in Go. However, I got stuck on how to sign the Public Signed PreKey.
Per the specifications it is supposed to be an X25519 key. In looking at previous implementations on Github they generated a [32]byte key from the curve25519 package and then converted it to an ed25519 key and then signed it.
However, the packages they used for the conversion are deprecated (github.com/agl/ed25519). Therefore, I either need to be able to convert the keys to ed25519 so I can sign them with the current ed25519 package (golang.org/x/crypto/25519) or implement a sign and verify function for curve25519 keys.
Ed25519 keys can be converted to X25519 keys easily, the twisted Edwards curve used by Ed25519 and the Montgomery curve used by X25519 are birationally equivalent.
Points on the Edwards curve are usually referred to as (x, y), while points on the Montgomery curve are usually referred to as (u, v).
You don't need a library to do the conversion, it's really simple...
(u, v) = ((1+y)/(1-y), sqrt(-486664)*u/x)
(x, y) = (sqrt(-486664)*u/v, (u-1)/(u+1))
Here is a great blog by Filippo Valsorda, the Golang security lead at Google, discussing this topic.
This takes in a public curve25519 key and converts it to an ed25519 public key. I did not write this code but appears to be doing what Woodstock above is stating. Further information would be welcomed:
func Verify(publicKey [32]byte, message []byte, signature *[64]byte) bool {
publicKey[31] &= 0x7F
/* Convert the Curve25519 public key into an Ed25519 public key. In
particular, convert Curve25519's "montgomery" x-coordinate into an
Ed25519 "edwards" y-coordinate:
ed_y = (mont_x - 1) / (mont_x + 1)
NOTE: mont_x=-1 is converted to ed_y=0 since fe_invert is mod-exp
Then move the sign bit into the pubkey from the signature.
*/
var edY, one, montX, montXMinusOne, montXPlusOne FieldElement
FeFromBytes(&montX, &publicKey)
FeOne(&one)
FeSub(&montXMinusOne, &montX, &one)
FeAdd(&montXPlusOne, &montX, &one)
FeInvert(&montXPlusOne, &montXPlusOne)
FeMul(&edY, &montXMinusOne, &montXPlusOne)
var A_ed [32]byte
FeToBytes(&A_ed, &edY)
A_ed[31] |= signature[63] & 0x80
signature[63] &= 0x7F
var sig = make([]byte, 64)
var aed = make([]byte, 32)
copy(sig, signature[:])
copy(aed, A_ed[:])
return ed25519.Verify(aed, message, sig)
This uses functions from "golang.org/x/crypto/ed25519/internal"

Value assignment in Alloy and use of Enum

How to assign variable in Alloy?
Sig ClassA{
variable_1: String,
variable_2: Int
}
Sig ClassB{
variable_1: String,
variable_2: Int
}
pred isLess[a:ClassA,b:ClassB]{
a.variable_2 < b.variable_2
}
assert integrityTest{
all a:ClassA,b:ClassB| isLess[a,b]
}
Now I want to check counterexample of variables when I assign some bigger value in a.variable_2 than b.variable_2. But I am not sure how to assign variable in Alloy. Only thing I came up with is following but it is not working-
pred assignValue[a:ClassA]{
a.variable_2 = Int[4]
}
However, I believe it will only check the equality with 4 and return as false. It has nothing to do with the assignment. So my question is how should I produce counterexample when a.variable_2>b.variable_2
And How can I use Enum of Int in alloy? Like- Enum MetricValue {1,2,3,4,5} to assign a.variable 1.
EDIT
I am still having trouble finding the counterexample, even though I can find one by manually checking when I toggle the value of variable_2 of ca and cb.
sig ClassA{
variable_1: String,
variable_2 = Int
}
sig CA extends ClassA{}{
variable_2 = 1
}
sig ClassB{
variable_1: String,
variable_2 = Int
}
sig CB extends ClassB{}{
variable_2 = 4
}
pred checkAllConstraint [ca: ClassA, cb: ClassB] {
ca.variable_2 > cb.variable_2 }
assert checkAll{
all ca: ClassA, cb: ClassB | checkAllConstraint[ca,cb]
}
check checkAll for 15
You can restrain a field to a single value through facts. In your case, signature facts come handy.
It will look like this:
sig ClassA{
variable_1: String,
variable_2: Int
}{
variable_1="hello world"
variable_2=4
}
To bound a field to one value amongst a set, you can use the "in" keyword instead of "=" as follows:
sig ClassA{
variable_1: String,
variable_2: Int
}{
variable_1 in ("hello" + "world")
variable_2 in (1+2+3+4)
}
Note that in Alloy + is a UNION operator. It doesn't sum nor concatenate as you might expect.
EDIT
It doesn't work for 2 reasons:
you wrote : variable_2 = Int instead of variable_2: Int.
By doing so, no valid instance contains atoms typed by CA or CB, because e.g. ClassA.variable2 is constrained to be the set of all integers and CA.variable2 is constrained to be 1
no String atom is defined. That's one of Alloy's weird part. If you want to use Strings in your model, you need to have string litterals somewhere specified, e.g. in a fact.
Here's your model, corrected:
sig ClassA{
variable_1: String,
variable_2 : Int
}
sig CA extends ClassA{}{
variable_2 = 1
}
sig ClassB{
variable_1: String,
variable_2 : Int
}
sig CB extends ClassB{}{
variable_2 = 4
}
pred checkAllConstraint [ca: ClassA, cb: ClassB] {
ca.variable_2 > cb.variable_2 }
assert checkAll{
all ca: ClassA, cb: ClassB | checkAllConstraint[ca,cb]
}
check checkAll for 15
fact { String in ("test"+"test2"+"test3"+"test4")}
If you still have questions, please create a new one.
-

Figuring out different CoNLL format

I am trying to generate a conll file from Stanford Core NLP, which then can be used as an input to Semafor (as semafor accepts conll file only).
The generated file looks like this:
1 My my PRP$ O 2 nmod:poss
2 kitchen kitchen NN O 5 nsubj
3 no no RB O 4 neg
4 longer longer RB O 5 advmod
5 smells smell VBZ O 0 ROOT
6 . . . O 5 punct
When I use this file, the Semafor server returns illegalArgument exception since the format is slightly different. Their example conll file looks like this:
1 My _ PRP$ PRP$ _ 2 NMOD _ _
2 kitchen _ NN NN _ 5 SBJ _ _
3 no _ RB RB _ 5 ADV _ _
4 longer _ RB RB _ 3 AMOD _ _
5 smells _ VBZ VBZ _ 0 ROOT _ _
6 . _ . . _ 5 P _ _
It seems that I can control the output by defining the keys. The default keys are ID, FORM, LEMMA,POSTAG,NER, HEAD, DEPREL. However, I don't know the keys for the example conll file provided by Semafor. Please guide me how I might convert the generated file format into Semafor example file format.
I believe that Semafor can generate its own conll file in the format that it needs. We use Stanford Core NLP just to split a document into sentences per line, and then use Semafor itself to generate the conll file.

C++ WINAPI: How to use SendMessage/PostMessage WM_KEYDOWN lparam

As an amateur to anything lower than VB/VBS (C++ WINAPI is a nightmare for someone of my experience) I have no idea how to go about constructing the long lParam for a simple KEYDOWN message in C++ and have probably spent more time looking for a decent explanation than is worth, would someone be able to describe exactly how to go about this?
It seems that almost every response to this question in other forums has been "why" or "use SendInput instead", without actually answering the question; I'm guessing that it's far too elementary for people to explain. Anyway here's the description from msdn, would very much appreciate a decent explanation or link to one, and a worked example if possible:
The repeat count, scan code,
extended-key flag, context code,
previous key-state flag, and
transition-state flag, as shown...
0-15 The repeat count for the current
message. The value is the number of
times the keystroke is autorepeated as
a result of the user holding down the
key. If the keystroke is held long
enough, multiple messages are sent.
However, the repeat count is not
cumulative. 16-23 The scan code. The
value depends on the OEM.
24 Indicates whether the key is an
extended key, such as the right-hand
ALT and CTRL keys that appear on an
enhanced 101- or 102-key keyboard. The
value is 1 if it is an extended key;
otherwise, it is 0. 25-28 Reserved; do
not use
29 The context code. The value is 1 if
the ALT key is down while the key is
pressed; it is 0 if the WM_SYSKEYDOWN
message is posted to the active window
because no window has the keyboard
focus.
30 The previous key state. The value
is 1 if the key is down before the
message is sent, or it is 0 if the key
is up.
31 The transition state. The value is
always 0 for a WM_SYSKEYDOWN message.
From the explanation of lParam parameter of WM_KEYDOWN message and Keystroke Message Flags chapter, I would write the following code to deal with the value of lParam:
iRepeatCount := LOWORD(lParam);
iScanCode := HIWORD(lParam) and $FF;
iExtendedKey := (HIWORD(lParam) and KF_EXTENDED) shr 8;
iContextCode := (HIWORD(lParam) and KF_ALTDOWN) shr 13;
iPreviousState := (HIWORD(lParam) and KF_REPEAT) shr 14;
iKeyDown := (HIWORD(lParam) and KF_UP) shr 15;
Although it is Delphi implementation, I'm sure you can understand such a simple code. :-)
OK, for your convenience, I google for shr instruction equivalent in VB, and I get this:
Private Function SHL(ByVal inVal As Long, ByVal inShift As Byte) As Long
SHL = inVal * (2 ^ inShift) ' Bit shift left
End Function
Private Function SHR(ByVal inVal As Long, ByVal inShift As Byte) As Long
SHR = inVal \ (2 ^ inShift) ' Bit shift right
End Function
To mimic the LOWORD and HIWORD in VB, see How to Mimic HIWORD, LOWORD, HIBYTE, LOBYTE C Macros in VB.
http://msdn.microsoft.com/en-us/library/ms646280(VS.85).aspx
The lparam is a 32 bit value; each bit controls a different aspect of the WM_KEYDOWN message.
To correctly fill out the lparam, you might try using spy++ to see what real WM_KEYDOWN messages look like.

Resources